[Mailman-Developers] Modifying mailman to filter archived
messages
Laurence Berland
laurence@digitalpulp.com
Wed, 24 Jul 2002 13:03:15 -0400
On Wednesday 24 July 2002 12:39 pm, Barry A. Warsaw wrote:
> >>>>> "LB" == Laurence Berland <laurence@digitalpulp.com> writes:
> LB> Just to clarify, body=msg.get_payload() sets body to the msg
> LB> payload, and msg.set_payload(body) sets the msg payload to
> LB> body, right?
>
> Basically, yes, as long as (in the set_payload() situation) you've got
> a text/plain message. Whether to use set_payload() or attach()
> depends on whether the container is multipart or not.
Ouch-I guess I missed this little detail. I'm trying to get an idea of how
best to do this. Does this work? (easier in pcode than english):
if not msg.is_multipart and msg_type=="text/plain":
bod=msg.get_payload()
<do transform on bod>
msg.set_payload(bod)
elif msg.get_type() == 'multipart/mixed':
for part in msg.walk()
if part_type == "text/plain":
bod=part.get_payload()
<do transform on bod>
part.set_payload(bod)
I've sort of cobbled this together on the fly here, so if it's totally off
please forgive my ignorance, stupidity, lack of sleep, etc...
Laurence