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 [EMAIL PROTECTED]
>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 '[EMAIL PROTECTED]' 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

'[EMAIL PROTECTED]' and/or u'[EMAIL PROTECTED]' 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 <[EMAIL PROTECTED]>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

--- f:/test-mailman-2.1/Mailman/Handlers/Decorate.py    2008-06-11 
15:09:34.000000000 -0700
+++ f:/test-mailman/Mailman/Handlers/Decorate.py        2008-10-28 
08:53:30.156250000 -0700
@@ -98,8 +98,18 @@
         # TK: Try to keep the message plain by converting the header/
         # footer/oldpayload into unicode and encode with mcset/lcset.
         # Try to decode qp/base64 also.
-        uheader = unicode(header, lcset, 'ignore')
-        ufooter = unicode(footer, lcset, 'ignore')
+        if isinstance(header, str):
+            uheader = unicode(header, lcset, 'ignore')
+        elif isinstance(header, unicode):
+            uheader = header
+        else:
+            assert False, 'Adding msg_header: header not string or unicode'
+        if isinstance(footer, str):
+            ufooter = unicode(footer, lcset, 'ignore')
+        elif isinstance(footer, unicode):
+            ufooter = footer
+        else:
+            assert False, 'Adding msg_footer: footer not string or unicode'
         try:
             oldpayload = unicode(msg.get_payload(decode=True), mcset)
             frontsep = endsep = u''
------------------------------------------------------
Mailman-Users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9

Reply via email to