Module: check_mk
Branch: master
Commit: dd91ae6d71a73302ae4952786dd14703078c5cfd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dd91ae6d71a733…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Tue May 15 10:42:56 2018 +0200
Remove Python <2.5 support from the mail Plugin which did not work anyway
Change-Id: Ie14aa3642ba077020df73939c3271c41a32c5216
---
notifications/mail | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)
diff --git a/notifications/mail b/notifications/mail
index 5404d7a..c0d862c 100755
--- a/notifications/mail
+++ b/notifications/mail
@@ -40,20 +40,10 @@ import urllib
import urllib2
import base64
-try:
- from email.mime.multipart import MIMEMultipart
- from email.mime.text import MIMEText
- from email.mime.application import MIMEApplication
- from email.mime.image import MIMEImage
-except ImportError:
- # python <2.5 compat
- # pylint: disable=no-name-in-module,import-error
- from email.MIMEMultipart import MIMEMultipart
- from email.MIMEText import MIMEText
- from email.MIMEImage import MIMEImage
- from email.MIMEBase import MIMEBase
- from email import Encoders
- MIMEApplication = None
+from email.mime.multipart import MIMEMultipart
+from email.mime.text import MIMEText
+from email.mime.application import MIMEApplication
+from email.mime.image import MIMEImage
try:
from simplejson import json
@@ -461,13 +451,7 @@ def multipart_mail(target, subject, from_address, reply_to,
content_txt, content
if what == 'img':
part = MIMEImage(contents, name = name)
else:
- if MIMEApplication != None:
- part = MIMEApplication(contents, name = name)
- else:
- # python <2.5 compat
- part = MimeBase('application', 'octet-stream') # pylint:
disable=undefined-variable
- part.set_payload(contents)
- Encoders.encode_base64(part)
+ part = MIMEApplication(contents, name = name)
part.add_header('Content-ID', '<%s>' % name)
# how must be inline or attachment