From 44864324e39b1610f6ce371b20b523c006779a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 7 May 2017 20:57:36 +0200 Subject: new 0115-Add_header.patch --- debian/patches/0105-try_mail.diff | 51 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 debian/patches/0105-try_mail.diff (limited to 'debian/patches/0105-try_mail.diff') diff --git a/debian/patches/0105-try_mail.diff b/debian/patches/0105-try_mail.diff new file mode 100644 index 0000000..6e11916 --- /dev/null +++ b/debian/patches/0105-try_mail.diff @@ -0,0 +1,51 @@ +Description: try / except around mail functions + add try / except around mail functions to + prevent python errors messages +Author: Jörg Frings-Fürst +Forwarded: via mail +Applied-Upstream: +Reviewed-by: +Last-Update: 2014-05-22 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: trunk/mwc.py +=================================================================== +--- trunk.orig/mwc.py ++++ trunk/mwc.py +@@ -212,15 +212,27 @@ def sendmail(receiver, subject, content, + mail['Subject'] = Header(subject, defaultEncoding) + + # initialize session once, not each time this method gets called +- if mailsession is None: +- mailsession = smtplib.SMTP(config.smtphost, config.smtpport) +- if config.useTLS: +- mailsession.ehlo() +- mailsession.starttls() +- mailsession.login(config.smtpusername, config.smtppwd) +- +- mailsession.sendmail(config.sender, receiver.split(','), mail.as_string()) +- ++ # ++ # add try / except to open mailsession ++ # ++ try: ++ if mailsession is None: ++ mailsession = smtplib.SMTP(config.smtphost, config.smtpport) ++ if config.useTLS: ++ mailsession.ehlo() ++ mailsession.starttls() ++ mailsession.login(config.smtpusername, config.smtppwd) ++ # ++ # add try / except to send mail ++ # ++ except: ++ print('Error: Open smtp-session') ++ exit(4) ++ try: ++ mailsession.sendmail(config.sender, receiver.split(','), mail.as_string()) ++ except: ++ print('Error: sendmail') ++ exit(5) + + # returns a list of all content that is stored locally for a specific site + def getFileContents(shortname): -- cgit v1.2.3