Opened 9 years ago
Closed 9 years ago
#3663 defect closed fixed (fixed)
imap4-utf-7 codec improperly registered
Reported by: | Jean-Paul Calderone | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | Keywords: | easy | |
Cc: | Branch: |
branches/imap4-utf7-registration-3663
branch-diff, diff-cov, branch-cov, buildbot |
|
Author: | exarkun |
Description
In Python 2.5, it's not possible to look up the imap4-utf-7 codec registered by twisted/mail/imap4.py:
exarkun@boson:~$ python Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from twisted.mail import imap4 >>> import codecs >>> codecs.lookup('imap4-utf-7') (<function encoder at 0x8395df4>, <function decoder at 0x8395e2c>, <class twisted.mail.imap4.StreamReader at 0x837bdac>, <class twisted.mail.imap4.StreamWriter at 0x837bddc>) >>> codecs.getreader('imap4-utf-7') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.5/codecs.py", line 920, in getreader return lookup(encoding).streamreader AttributeError: 'tuple' object has no attribute 'streamreader' >>>
Though this did use to work:
exarkun@boson:~$ ~/Projects/python/branches/release23-maint/python Python 2.3.7 (#2, Mar 25 2008, 19:31:49) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from twisted.mail import imap4 >>> import codecs >>> codecs.getreader('imap4-utf-7') <class twisted.mail.imap4.StreamReader at 0xb7a0d5fc> >>>
Also, StreamWriter
might be misdefined. It has a decode
method, but perhaps it should have an encode
method.
Change History (7)
comment:1 Changed 9 years ago by
Keywords: | easy added |
---|
comment:2 Changed 9 years ago by
Author: | → exarkun |
---|---|
Branch: | → branches/imap4-utf7-registration-3663 |
comment:3 Changed 9 years ago by
comment:4 Changed 9 years ago by
Keywords: | review added |
---|---|
Owner: | Jean-Paul Calderone deleted |
comment:5 Changed 9 years ago by
Keywords: | review removed |
---|---|
Owner: | set to Jean-Paul Calderone |
Looks good. Merge.
comment:6 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [26479]) Merge imap4-utf7-registration-3663
Author: exarkun Reviewer: glyph Fixes: #3663
Update the IMAP4-UTF7 codec registration to use the preferred Python 2.5 behavior
of returning a CodecInfo instance instead of a four tuple. This causes the
codecs.getreader and codecs.getwriter functions to work for this encoding (again).
Also fix the implementation of the stream writer to define the correct method,
encode
, instead of the incorrect one, decode
.
comment:7 Changed 7 years ago by
Owner: | Jean-Paul Calderone deleted |
---|
(In [26379]) Branching to 'imap4-utf7-registration-3663'