Skip to content

Commit 9a1414c

Browse files
issue2550877: Writing headers with the email module will use continuation_ws = ' ' now for python 2.5 and 2.6 when importing anypy.email_.
1 parent d9fed98 commit 9a1414c

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

CHANGES.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ Fixed:
146146
initial patch (John Kristensen)
147147
- Documentation: configuration messages_to_author value "nosy" now documented
148148
in chapter "customizing". (Bernhard Reiter)
149-
- issue2550877 Five failures in test_mailgw.py because of duplicated headers
150-
and more precise comparision. (Bernhard Reiter)
149+
- issue2550877 Failures in test_mailgw.py because of duplicated headers
150+
and more precise comparision. Writing headers with the email module will use
151+
continuation_ws = ' ' now for python 2.5 and 2.6. (Bernhard Reiter)
151152

152153

153154
2013-07-06: 1.5.0

roundup/anypy/email_.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
import re
22
import binascii
3+
import email
34
from email import quoprimime, base64mime
45

6+
## please import this file if you are using the email module
7+
#
8+
# a "monkey patch" to unify the behaviour of python 2.5 2.6 2.7
9+
# when generating header files, see http://bugs.python.org/issue1974
10+
# and https://hg.python.org/cpython/rev/5deb27042e5a/
11+
# can go away once the minimum requirement is python 2.7
12+
_oldheaderinit = email.Header.Header.__init__
13+
def _unifiedheaderinit(self, *args, **kw):
14+
# override continuation_ws
15+
kw['continuation_ws'] = ' '
16+
_oldheaderinit(self, *args, **kw)
17+
email.Header.Header.__dict__['__init__'] = _unifiedheaderinit
18+
##
19+
520
try:
621
# Python 2.5+
722
from email.parser import FeedParser

roundup/cgi/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from email.MIMEBase import MIMEBase
3232
from email.MIMEText import MIMEText
3333
from email.MIMEMultipart import MIMEMultipart
34+
import roundup.anypy.email_
3435

3536
def initialiseSecurity(security):
3637
'''Create some Permissions and Roles on the security object

roundup/mailer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
from email.mime.text import MIMEText
1717
from email.mime.multipart import MIMEMultipart
1818

19+
from roundup.anypy import email_
20+
1921
try:
2022
import pyme, pyme.core
2123
except ImportError:

test/test_mailgw.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import gpgmelib
1616
import unittest, tempfile, os, shutil, errno, imp, sys, difflib, time
1717

18-
1918
try:
2019
import pyme, pyme.core
2120
except ImportError:

0 commit comments

Comments
 (0)