From 8e221e224b15f7c77eb4c3bccc6325dea61a14d7 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Sun, 27 May 2012 22:10:51 +0200 Subject: support sending mail without pdf attachment --- invoice/generate-invoice.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'invoice') diff --git a/invoice/generate-invoice.py b/invoice/generate-invoice.py index eb6c07e..3ac65b2 100755 --- a/invoice/generate-invoice.py +++ b/invoice/generate-invoice.py @@ -135,9 +135,10 @@ def generate_mail(receiver, subject, message, pdfdata, cc = None): msg.attach(MIMEText(message, 'plain', 'utf-8')) - pdf = MIMEApplication(pdfdata, 'pdf') - pdf.add_header('Content-Disposition', 'attachment', filename = 'rechnung.pdf') - msg.attach(pdf) + if pdfdata is not None: + pdf = MIMEApplication(pdfdata, 'pdf') + pdf.add_header('Content-Disposition', 'attachment', filename = 'rechnung.pdf') + msg.attach(pdf) return msg @@ -196,4 +197,13 @@ def daily(timestamp = time.time()): else: print("Can't send invoice for missing user with the following id:", user) +def monthly(timestamp = time.time()): + print("monthly invoice()") + +def backup(timestamp = time.time()): + print("backup()") + +def stock(timestamp = time.time()): + print("stock()") + daily() -- cgit v1.2.3