[Mailman-Users] Messages shunted with "TypeError: decoding Unicode is not supported"

Mark Sapiro mark at msapiro.net
Tue Oct 28 17:08:07 CET 2008


Josh Clark wrote:

>> Try applying the attached Decorate.patch.txt patch to
>> Mailman/Handlers/Decorate.py and restart mailman.
>>
>> Then try the post and report what you find in Mailman's 'debug' log.
>
>Thanks again, Mark. Here's what shows up in the debug log (email  
>address anonymized to protect the innocent; it was an unremarkable  
>yahoo.com account).
>
>$ cat debug
>Oct 28 05:14:39 2008 (22325) msg_footer type: <type 'str'>
>footer type: <type 'unicode'>
>footer: _______________________________________________
>You are subscribed to this mailing list as address at example.com
>To edit your subscription options or to unsubscribe, visit:
>http://mailman.example.com/mailman/options/moxiemail/address%40example.com
>
>lcset: us-ascii


That narrows it down a bit. What is happening is one of the strings
being interpolated into the footer is unicode. The footer is

msg_footer = """_______________________________________________
You are subscribed to this mailing list as %(user_address)s
To edit your subscription options or to unsubscribe, visit:
%(user_optionsurl)s"""

and somehow this 'address at example.com' is unicode rather than a string.

Try the following:

Remove the patch from Decorate.py as it isn't needed any more. Then do

$ bin/withlist moxiemail
Loading list moxiemail (unlocked)
The variable `m' is the moxiemail MailList instance
>>> for mem in m.getMembers():
...     print repr(m.getMemberCPAddress(mem))
...

The first line above represents a prompt and a withlist command. The
next lines are output from withlist ending with a '>>> ' python
prompt. You type what follows the prompt and get a '... ' prompt
because the 'for' is incomplete. You type the next line indented, and
then just <CR> to the next prompt. This should be followed by a list of

'address at example.com' and/or u'address at example.com' like addresses
ending with a '>>> ' prompt. Type control-D at this prompt to quit.

I'm interested in how many of these addresses are u'...', and how they
got to be that way. The above will answer the first question.

The attached patch to Decorate.py (applied after removing the other
one) will work around the problem, but the real question is how the
'case preserved' addresses got to be unicode in the first place.

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: decorate.patch.txt
URL: <http://mail.python.org/pipermail/mailman-users/attachments/20081028/76521ff4/attachment-0001.txt>


More information about the Mailman-Users mailing list