diff options
| author | Barry Warsaw | 2007-11-06 18:16:22 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2007-11-06 18:16:22 -0500 |
| commit | d6377c92857c513faf484ef9a91a6b00da789d4b (patch) | |
| tree | c00600e52ec7ad327c947bc9a756e2694478a4d6 /Mailman/Message.py | |
| parent | 46f480dfaa6286ff8950af817de1c35910b37e16 (diff) | |
| download | mailman-d6377c92857c513faf484ef9a91a6b00da789d4b.tar.gz mailman-d6377c92857c513faf484ef9a91a6b00da789d4b.tar.zst mailman-d6377c92857c513faf484ef9a91a6b00da789d4b.zip | |
Fix two doctests: ack-headers and acknowledgment.
This hacks around an apparent bug in the email package where if you parse a
unicode message string, you still end up getting 8-bit strings out of the
headers, and probably payloads.
The hack is to override Mailman.Message.Message.__getitem__() to force the
header value returned to a Unicode. It must be ASCII but this is required
anyway by RFC 2822. It's not perfect, but it lets us get farther without
forcing a detour into fixing the email package.
Other changes:
- Fix the Address table's references, and also update the subscribe() query.
- Fix the Member table's references and add a __init__().
- Fix Roster's get_member() query.
- Fix the Enum class's variable_class attribute.
- UserManager.create_user() has to use Unicodes for real_name.
Diffstat (limited to 'Mailman/Message.py')
| -rw-r--r-- | Mailman/Message.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Mailman/Message.py b/Mailman/Message.py index 7b1f22d8c..5e05892b6 100644 --- a/Mailman/Message.py +++ b/Mailman/Message.py @@ -45,6 +45,12 @@ class Message(email.message.Message): self.__version__ = VERSION email.message.Message.__init__(self) + def __getitem__(self, key): + value = email.message.Message.__getitem__(self, key) + if isinstance(value, str): + return unicode(value, 'ascii') + return value + # BAW: For debugging w/ bin/dumpdb. Apparently pprint uses repr. def __repr__(self): return self.__str__() |
