Ok, I got this piece kind of working, but there is a problem with this.

This is my search and replace string, and the search at this point doesn't
matter.

pl = re.sub('lksjdfsdf', 'new text', pl)

Here is the last part of the body, it is all contained in one line:

"You received this e-mail because you are currently subscribed to this
message board alert. To unsubscribe from this alert, or to change your
settings to receive a digest version instead, please visit My Alerts."

After this message goes through mailman, this is how it comes out on the
other side:

jZ;]yay%"hh?hjfzjCj?k-yM:4r^=JjgV'qbsOyDKijljw,&gZ,j
}z?Ox^=by?m+m?y?+.n+a?Oy?zS?&~&jWZ zb
-z+i?zoz"x?v^j??3 %zl

If I add, or remove a letter to the orginal footer, anywhere, or change any
one of the punctuation marks to a letter, it will come through clean, and
not garbled.

I am stumped!







 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of Mark Sapiro
Sent: Thursday, May 11, 2006 3:53 PM
To: mailman-users@python.org
Subject: Re: [Mailman-Users] Custom footer based on sender's email

Mark Sapiro wrote:

>Rob Jackson wrote:
>
<snip>
>>+    pl = msg.get_payload(decode=True)
>>+    re.sub('AZ', 'new text', pl)
>>+    msg.set_payload(pl)
<snip>
>
>It looks OK to me.

Actually, it's not OK. I overlooked the fact that Python strings are
immutable and re.sub doesn't (can't) change them in place. Thus,

    re.sub('AZ', 'new text', pl)

needs to be

    pl = re.sub('AZ', 'new text', pl)

-- 
Mark Sapiro <[EMAIL PROTECTED]>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

------------------------------------------------------
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe:
http://mail.python.org/mailman/options/mailman-users/robertj%40linux4free.co
m

Security Policy:
http://www.python.org/cgi-bin/faqw-mm.py?req=show&amp;file=faq01.027.htp

------------------------------------------------------
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
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://www.python.org/cgi-bin/faqw-mm.py?req=show&amp;file=faq01.027.htp

Reply via email to