summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8fdf2ac)
raw | patch | inline | side by side (parent: 8fdf2ac)
author | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 27 Dec 2009 20:05:32 +0000 (20:05 +0000) | ||
committer | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 27 Dec 2009 20:05:32 +0000 (20:05 +0000) |
mangle the email address making it unusable when replying. Thanks to
intevation for funding the fix.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4417 57a73879-2fb5-44c3-a270-3262357dd7e2
intevation for funding the fix.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4417 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/mailer.py | patch | blob | history | |
test/test_mailgw.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index 082f0728f0f6e7f3e291969d0de519ea0bf09385..7cc30077c37dcc7b0b3ed9541b0825c5ce4c5c54 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
http://thread.gmane.org/gmane.comp.bug-tracking.roundup.devel/5133
Add regression tests for proper handling of 'Create' and 'Edit'
permissions.
+- Fix handling of non-ascii in realname in the nosy mailer, this used to
+ mangle the email address making it unusable when replying. Thanks to
+ intevation for funding the fix.
2009-12-21 1.4.11 (r4411)
diff --git a/roundup/mailer.py b/roundup/mailer.py
index 453a1ded0ed45c614eba34d5414bb0c6080e374a..f1a1af3bdf45a20f469dd7132b022449cf922df1 100644 (file)
--- a/roundup/mailer.py
+++ b/roundup/mailer.py
charset = getattr(self.config, 'EMAIL_CHARSET', 'utf-8')
tracker_name = unicode(self.config.TRACKER_NAME, 'utf-8')
if not author:
- author = formataddr((tracker_name, self.config.ADMIN_EMAIL))
+ author = (tracker_name, self.config.ADMIN_EMAIL)
+ name = author[0]
else:
name = unicode(author[0], 'utf-8')
- author = formataddr((name, author[1]))
+ try:
+ name = name.encode('ascii')
+ except UnicodeError:
+ name = Header(name, charset).encode()
+ author = formataddr((name, author[1]))
if multipart:
message = MIMEMultipart()
except UnicodeError:
message['Subject'] = Header(subject, charset)
message['To'] = ', '.join(to)
- try:
- message['From'] = author.encode('ascii')
- except UnicodeError:
- message['From'] = Header(author, charset)
+ message['From'] = author
message['Date'] = formatdate(localtime=True)
# add a Precedence header so autoresponders ignore us
diff --git a/test/test_mailgw.py b/test/test_mailgw.py
index 251b47cde591f84dbf720ffbf94d4ad2dd305be5..b35f3567b374e9393fdfa9df1c2511eed2fd2314 100644 (file)
--- a/test/test_mailgw.py
+++ b/test/test_mailgw.py
''')
def testEnc01(self):
+ self.db.user.set(self.mary_id,
+ realname='\xe4\xf6\xfc\xc4\xd6\xdc\xdf, Mary'.decode
+ ('latin-1').encode('utf-8'))
self.doNewIssue()
self._handle_mail('''Content-Type: text/plain;
charset="iso-8859-1"
Content-Type: text/plain; charset="utf-8"
Subject: [issue1] Testing...
To: chef@bork.bork.bork, richard@test.test
-From: "Contrary, Mary" <issue_tracker@your.tracker.email.domain.example>
+From: =?utf-8?b?w6TDtsO8w4TDlsOcw58sIE1hcnk=?=
+ <issue_tracker@your.tracker.email.domain.example>
Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
MIME-Version: 1.0
Message-Id: <followup_dummy_id>
Content-Transfer-Encoding: quoted-printable
-Contrary, Mary <mary@test.test> added the comment:
+=C3=A4=C3=B6=C3=BC=C3=84=C3=96=C3=9C=C3=9F, Mary <mary@test.test> added the=
+ comment:
A message with encoding (encoded oe =C3=B6)