
Due to a change in the Message board, the messages come through as multipart/mixed.
If I try to run this in the multipart/mixed section of Decorate.py, I get:
TypeError: expected string or buffer.
What needs to be done to make this work properly?
Thanks -Rob
-----Original Message----- From: Rob Jackson [mailto:robertj@linux4free.com] Sent: Monday, May 15, 2006 2:49 PM To: 'Rob Jackson'; 'Mark Sapiro'; mailman-users@python.org Subject: RE: [Mailman-Users] Custom footer based on sender's email
I found a fix the the problem. Charset is set to UTF-8, and I changed it to us-ascii, and it works great now.
-Rob
-----Original Message----- From: mailman-users-bounces+robertj=linux4free.com@python.org [mailto:mailman-users-bounces+robertj=linux4free.com@python.org] On Behalf Of Rob Jackson Sent: Monday, May 15, 2006 12:26 PM To: 'Mark Sapiro'; mailman-users@python.org Subject: Re: [Mailman-Users] Custom footer based on sender's email
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: mailman-users-bounces+robertj=linux4free.com@python.org [mailto:mailman-users-bounces+robertj=linux4free.com@python.org] 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 <msapiro@value.net> 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&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/robertj%40linux4free.co m
Security Policy: http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp