Skip to content

Commit cee288b

Browse files
committed
Remove rfc2822.py
A majority of the module is not being used, and the one function that is being used can easily be replicated in mailgw.py, meaning that everything related to the rfc2822 module can be removed.
1 parent e7daca7 commit cee288b

File tree

4 files changed

+4
-207
lines changed

4 files changed

+4
-207
lines changed

roundup/mailgw.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class node. Any parts of other types are each stored in separate files
8585

8686
from anypy.email_ import decode_header
8787

88-
from roundup import configuration, hyperdb, date, password, rfc2822, exceptions
88+
from roundup import configuration, hyperdb, date, password, exceptions
8989
from roundup.mailer import Mailer, MessageSendError
9090
from roundup.i18n import _
9191
from roundup.hyperdb import iter_roles
@@ -320,8 +320,9 @@ def getbody(self):
320320
data = self.fp.read()
321321

322322
# Encode message to unicode
323-
charset = rfc2822.unaliasCharset(self.getparam("charset"))
323+
charset = self.getparam("charset")
324324
if charset:
325+
charset = charset.lower().replace("windows-", 'cp')
325326
# Do conversion only if charset specified - handle
326327
# badly-specified charsets
327328
edata = unicode(data, charset, 'replace').encode('utf-8')

roundup/rfc2822.py

Lines changed: 0 additions & 166 deletions
This file was deleted.

test/test_mailgw.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from roundup import mailgw, i18n, roundupdb
3131
from roundup.mailgw import MailGW, Unauthorized, uidFromAddress, \
3232
parseContent, IgnoreLoop, IgnoreBulk, MailUsageError, MailUsageHelp
33-
from roundup import init, instance, password, rfc2822, __version__
33+
from roundup import init, instance, password, __version__
3434
from roundup.anypy.sets_ import set
3535

3636
#import db_test_base
@@ -2534,13 +2534,6 @@ def testUserCreate(self):
25342534
i = uidFromAddress(self.db, ('', '[email protected]'), 1)
25352535
self.assertNotEqual(uidFromAddress(self.db, ('', '[email protected]'), 1), i)
25362536

2537-
def testRFC2822(self):
2538-
ascii_header = "[issue243] This is a \"test\" - with 'quotation' marks"
2539-
unicode_header = '[issue244] \xd0\xb0\xd0\xbd\xd0\xb4\xd1\x80\xd0\xb5\xd0\xb9'
2540-
unicode_encoded = '=?utf-8?q?[issue244]_=D0=B0=D0=BD=D0=B4=D1=80=D0=B5=D0=B9?='
2541-
self.assertEqual(rfc2822.encode_header(ascii_header), ascii_header)
2542-
self.assertEqual(rfc2822.encode_header(unicode_header), unicode_encoded)
2543-
25442537
def testRegistrationConfirmation(self):
25452538
otk = "Aj4euk4LZSAdwePohj90SME5SpopLETL"
25462539
self.db.getOTKManager().set(otk, username='johannes')

test/test_rfc2822.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)