[Mailman-Users] Recovering a config.pck file from the output ofdumpdb

Mark Sapiro msapiro at value.net
Wed Jan 10 22:30:14 CET 2007


Kelly Jones wrote:

>I backup my mailman config.pck files nightly by running "dumpdb
>config.pck" and storing the output (the output of dumpdb is easier to
>read and easier to diff [for CVS'd backups] than the config.pck file
>itself).
>
>How do I get back config.pck from the output of dumpdb?
>
>In other words, what command does the opposite/inverse of dumpdb?


There is no command to create the config.pck from the output of dumpdb.

The output of dumpdb of a config.pck is basically a dictionary
representation where the keys are the names of all the list attributes
and the values are the respective values.

If you were to take a dumpdb output that looks something like

[----- start pickle file -----]
<----- start object 1 ----->
{   'accept_these_nonmembers': ['msapiro at value.net'],
    'acceptable_aliases': '\n',
    'admin_immed_notify': True,
    'admin_member_chunksize': 30,
    'admin_notify_mchanges': 1,
    'admin_responses': {},
...
    'welcome_msg': ''}
[----- end pickle file -----]

and edit it to make something like

mlist.accept_these_nonmembers = ['msapiro at value.net']
mlist.acceptable_aliases = '\n'
mlist.admin_immed_notify = True
mlist.admin_member_chunksize = 30
mlist.admin_notify_mchanges = 1
mlist.admin_responses = {}
...
mlist.welcome_msg = ''


you could use that as input to bin/config_list.

Alternatively, you could make it into a withlist script that would look
something like:

def undumpdb(mlist):
    x = {   'accept_these_nonmembers': ['msapiro at value.net'],
    'acceptable_aliases': '\n',
    'admin_immed_notify': True,
    'admin_member_chunksize': 30,
    'admin_notify_mchanges': 1,
    'admin_responses': {},
...
    'welcome_msg': ''}

    for key in x.keys():
        mlist.__dict__[key] = x[key]
    mlist.Save()

-- 
Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the Mailman-Users mailing list