[Mailman-Developers] handler to auto detach attachment and link it to a website keeping html

Sylvain Viart sylvain at opensource-expert.com
Wed Apr 23 17:31:37 CEST 2014


I'm a bit confused, but it works…
Thanks. :-)

Le 23/04/2014 15:30, Mark Sapiro a écrit :
>> I need to set :
>>
>> mlist.ftp_remote_host = 'ftp.example.com'
>> mlist.ftp_remote_login = 'somelogin'
>> mlist.ftp_remote_pass = 'secretstuff'
>>
>>
>> I can set site global vars in /etc/mailman/mm_cfg.py but how do I set
>> local list parameter exactly?
>
> bin/withlist or bin/config_list.
>
> E.g., put the above three lines in a file and run
>
> bin/config_list -i /path/to/file listname.

Works great as you said! :-)
I wasn't sure how to use this tool. I supposed you have to dump the 
whole config first with -o, add my stuff and reload the whole…
But it's state's keeping between call of bin/config_list… Cool.


# config_list -v -i t.py testlist
# withlist -i testlist
Loading list testlist (unlocked)
The variable `m' is the testlist MailList instance
 >>> m.ftp_remote_host
'ftp.example.com'

this one gives nothing…
# config_list -o - testlist | grep ftp

Can I guess that this tool don't exactly dump the full list state?
It can't be used for duplicating or full backup for instance?


My test this morning was failing because of wrong usage… See bellow.
I tested your script set_attributes 
<http://fog.ccsf.edu/%7Emsapiro/scripts/set_attributes>

    Mark Sapiro's page : scripts that automate certain mailing list
    management tasks <http://fog.ccsf.edu/~msapiro/scripts/
    <http://fog.ccsf.edu/%7Emsapiro/scripts/>>


Which gives:

# /usr/lib/mailman/bin/list_set_attributes "ftp_remote_host = 
'ftp.example.org'" testlist
attribute "ftp_remote_host" changed
Non-standard property restored: ftp_remote_host

If the extend.py exists with variable defined as follow:

to be set in lists/yourlistname/extend.py

import copy
from Mailman import mm_cfg
def extend(mlist):
     mlist.pipeline = copy.copy(mm_cfg.GLOBAL_PIPELINE)
     # The next line inserts MyHandler ahead of Moderate.
     mlist.pipeline.insert(mlist.pipeline.index('Moderate'), 'MyHandler')
     # Alternatively, the next line replaces Moderate with MyHandler
     #mlist.pipeline[mlist.pipeline.index('Moderate')] = 'MyHandler'
     # Pick one of the two above example alternatives

     mlist.ftp_remote_host = 'ftp.example.com'
     mlist.ftp_remote_login = 'username'
     mlist.ftp_remote_pass = 'secr3te'
     # put the ending slash /
     mlist.remote_http_base = 'http://example.com/root/for/username/'


If the value are not defined first I got:

/usr/lib/mailman/bin/list_set_attributes "dumy_remote_host = 
'ftp.example.org'" testlist
attribute "dumy_remote_host" ignored


works with "mlist.dumy_remote_host = 'ftp.example.org'" as you explained 
at the top, of course…

> Note, I just removed the information about using extend.py from the FAQ
> at <http://wiki.list.org/x/l4A9> because the only reason it was there
> was for the situation where GLOBAL_PIPELINE would change in the future,
> and it won't work for that anyway because the list's existing pipeline
> attribute will override it.
>

Hum… I'm using it. How I'm supposed to modify the pipeline, so?…
/usr/lib/mailman/bin/version
Using Mailman version: 2.1.15

Using config_list ok… Hum probably not…

# cat t.py
import copy
from Mailman import mm_cfg
mlist.pipeline = copy.copy(mm_cfg.GLOBAL_PIPELINE)
# The next line inserts MyHandler ahead of Moderate.
mlist.pipeline.insert(mlist.pipeline.index('Moderate'), 'MyHandler')


# config_list -v -i t.py testlist
attribute "mm_cfg" ignored
attribute "copy" ignored




Regards,
Sylvain.



More information about the Mailman-Developers mailing list