summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7ec2330)
raw | patch | inline | side by side (parent: 7ec2330)
author | kedder <kedder@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 6 May 2003 21:49:20 +0000 (21:49 +0000) | ||
committer | kedder <kedder@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 6 May 2003 21:49:20 +0000 (21:49 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1693 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/rfc2822.py | patch | blob | history | |
test/test_mailgw.py | patch | blob | history |
diff --git a/roundup/rfc2822.py b/roundup/rfc2822.py
index d601ee13ae857d00e8a5194679987cbe7caff5f3..0faa833f2e34d047af431c34fdcb16a96acb7a29 100644 (file)
--- a/roundup/rfc2822.py
+++ b/roundup/rfc2822.py
import re
+from string import letters, digits
from binascii import b2a_base64, a2b_base64
ecre = re.compile(r'''
\?= # literal ?=
''', re.VERBOSE | re.IGNORECASE)
-hqre = re.compile(r'^[-a-zA-Z0-9!*+/\[\]., ]+$')
+hqre = re.compile(r'^[A-z0-9!"#$%%&\'()*+,-./:;<=>?@\[\]^_`{|}~ ]+$')
def base64_decode(s, convert_eols=None):
"""Decode a raw base64 string.
diff --git a/test/test_mailgw.py b/test/test_mailgw.py
index d524b787f73e3875eaa39b3879fdc399f0f6e646..355de47a434eec81c01ad8c9f3fa0057f93648aa 100644 (file)
--- a/test/test_mailgw.py
+++ b/test/test_mailgw.py
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: test_mailgw.py,v 1.45 2003-04-27 02:16:47 richard Exp $
+# $Id: test_mailgw.py,v 1.46 2003-05-06 21:49:20 kedder Exp $
import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib
import rfc822
# import rfc822 as email
from roundup.mailgw import MailGW, Unauthorized, uidFromAddress
-from roundup import init, instance
+from roundup import init, instance, rfc2822
# TODO: make this output only enough equal lines for context, not all of
# them
i = uidFromAddress(self.db, ('', 'user@foo.com'), 1)
self.assertNotEqual(uidFromAddress(self.db, ('', 'user@bar.com'), 1), i)
+ def testRFC2822(self):
+ ascii_header = "[issue243] This is a \"test\" - with 'quotation' marks"
+ unicode_header = '[issue244] \xd0\xb0\xd0\xbd\xd0\xb4\xd1\x80\xd0\xb5\xd0\xb9'
+ unicode_encoded = '=?utf-8?q?[issue244]_=D0=B0=D0=BD=D0=B4=D1=80=D0=B5=D0=B9?='
+ self.assertEqual(rfc2822.encode_header(ascii_header), ascii_header)
+ self.assertEqual(rfc2822.encode_header(unicode_header), unicode_encoded)
+
def suite():
l = [unittest.makeSuite(MailgwTestCase),
]