[Mailman-Developers] admindb addition (was: tech docs?)

Ricardo Kustner ricardo@miss-janet.com
Wed, 11 Aug 1999 22:56:05 +0200 (CEST)


Hi,

I hate to reply to my own posts (as usual ;) ) but is anybody else interested
in this feature or agrees this can be an usfull addition to mailman? if i get
some positive responses, i'm going to have a better look at the mailman source
and i'll try to fit it in and make it and configurable option...
if anybody this my python code sucks... let me know! :)

Thanks,
Ricardo.

On 05-Aug-99 Ricardo Kustner wrote:
> one thing i really wanted to fix fast was stripping a lot of the headers you
> see on the moderated posts page... 
> this is what i made for it (this it my first piece of python ever so it can
> be probably made much more efficient ;) ) It's just a function a call in
> admindb.py
> before it outputs the message on the screen with Preformatted()
> ideally this could be a config option and one should be able to choose which
> headers to show in the output.
> 
> ====
> def stripheaders(msg):
> 
>     found = 0
>     emsg = '' 
>     # define which headers to keep
>     headers = ['From:', 'To:', 'Date:', 'Subject:']
> 
>     for i in string.split(msg, "\012"):
>         if not found:
>             for j in headers:
>                 if i[:len(j)] == j:
>                         emsg = emsg + i + "\012"
>             # the first empty line means we're done with the headers part
>             if i == "":
>                 found = 1
>                 emsg = emsg + "\012"
>         else:
>             # we've had the header part so every line can be added back
>             emsg = emsg + i + "\012"
> 
>     return(emsg)
> ====