Modify ↓
#11890 closed task (fixed)
Remove Python 2.1 to 2.4 compatibility for email modules
Reported by: | Peter Suter | Owned by: | Peter Suter |
---|---|---|---|
Priority: | normal | Milestone: | 1.1.3 |
Component: | general | Version: | |
Severity: | normal | Keywords: | python26 |
Cc: | Branch: | ||
Release Notes: |
Removed support for missing |
||
API Changes: | |||
Internal Changes: |
Description
In #386 email
imports were changed to local imports for Python 2.1 compatibility. We could again use normal imports.
Also in Python 2.5 all email
submodules have been renamed according to PEP 8 standards. We still use the old uppercase names.
-
trac/notification/compat.py
diff -r e60f921d031d -r 4d1945219ada trac/notification/compat.py
a b 15 15 16 16 import re 17 17 from abc import ABCMeta, abstractmethod 18 from email.utils import formatdate 18 19 19 20 from genshi.builder import tag 20 21 … … 175 176 reactivate(t) 176 177 177 178 def send(self, torcpts, ccrcpts, mime_headers={}): 178 from email.Utils import formatdate179 179 body = self._format_body() 180 180 public_cc = self.config.getbool('notification', 'use_public_cc') 181 181 headers = { -
trac/notification/mail.py
diff -r e60f921d031d -r 4d1945219ada trac/notification/mail.py
a b 20 20 import re 21 21 import smtplib 22 22 import time 23 from email.MIMEMultipart import MIMEMultipart 24 from email.MIMEText import MIMEText 25 from email.Utils import formatdate, parseaddr, getaddresses 23 from email.charset import BASE64, QP, SHORTEST, Charset 24 from email.header import Header 25 from email.mime.multipart import MIMEMultipart 26 from email.mime.text import MIMEText 27 from email.utils import formatdate, parseaddr, getaddresses 26 28 from hashlib import md5 27 29 from subprocess import Popen, PIPE 28 30 … … 69 71 Quoted-Printable, and 'none' for no encoding, in which case mails will 70 72 be sent as 7bit if the content is all ASCII, or 8bit otherwise. 71 73 """ 72 from email.Charset import BASE64, QP, SHORTEST, Charset73 74 charset = Charset() 74 75 charset.input_charset = 'utf-8' 75 76 charset.output_charset = 'utf-8' … … 93 94 94 95 def create_header(key, name, charset): 95 96 """Create an appropriate email Header.""" 96 from email.Header import Header97 97 maxlength = MAXHEADERLEN-(len(key)+2) 98 98 # Do not sent ridiculous short headers 99 99 if maxlength < 10: -
trac/util/__init__.py
diff -r e60f921d031d -r 4d1945219ada trac/util/__init__.py
a b 744 744 else: 745 745 return {} 746 746 import email 747 import email.errors 747 748 from trac.util.translation import _ 748 749 attrs = ('author', 'author-email', 'license', 'home-page', 'summary', 749 750 'description', 'version') … … 760 761 metadata=metadata, dist=dist, err=to_unicode(e)) 761 762 for attr in attrs: 762 763 info[normalize(attr)] = err 763 except email. Errors.MessageError as e:764 except email.errors.MessageError as e: 764 765 err = _("Failed to parse %(metadata)s file for %(dist)s: %(err)s", 765 766 metadata=metadata, dist=dist, err=to_unicode(e)) 766 767 for attr in attrs:
Attachments (0)
Change History (2)
comment:1 by , 10 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:2 by , 10 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Committed in [13577].