conn.commit()
-def mark_pay():
+def mark_pay(outdir):
betrag = int(raw_input("Betrag: "))
+ template = env.get_template('eingangsbestaetigung.eml')
+
while True:
uid = raw_input("User: ")
if uid == "":
break
uid = int(uid)
conn.execute("UPDATE teilnehmer SET bezahlt = ? WHERE id = ?", [betrag, uid])
+ vorname, nachname, email = conn.execute("SELECT vorname, nachname, email FROM teilnehmer WHERE id = ?", [uid]).fetchone()
+
+ with open(os.path.join(outdir, email), 'w') as f:
+ f.write(template.render(vorname=vorname.decode('utf-8'),
+ nachname=nachname.decode('utf-8'),
+ email=email.decode('utf-8'),
+ betrag=betrag).encode('utf-8'))
conn.commit()
conn = sqlite3.connect(args.db)
conn.text_factory = str
- if args.nametag or args.email:
+ if args.nametag or args.email or args.pay:
assert(args.output)
if not os.path.exists(args.output):
os.mkdir(args.output)
create_nametag(args.output)
elif args.email:
create_mail(args.output)
+ elif args.pay:
+ mark_pay(args.output)
elif args.importcsv:
assert(args.input)
import_teilnehmer(args.input)
- elif args.pay:
- mark_pay()
-
if __name__ == '__main__':
main()