[Mailman-Developers] Exporting member info (including options)

Aaron Kreider aaron at campusactivism.org
Mon Aug 16 23:04:28 CEST 2010


  I'm figuring out where to get the information from the config.pck 
(pickle file) for each list to populate the MySQL table.

It seems like the MySQL format is extracting some of its fields from the 
user_options fields, is this true?
If this is true, it is confusing because several of the user_options are 
listed in their own field AND in the user_options field.


***MySQL field -- Pickle Source***
address -- members object
hide -- useroptions (16)
nomail -- useroptions (128) - am I right about this?
ack -- useroptions (4)
not_metoo -- useroptions (2)
digest -- digest_members object
plain -- useroptions (8)
password -- password object
lang -- language object
name -- usernames object
one_last_digest -- one_last_digest object.  I guess the email would be 
listed here if I had any people using this setting.
user_options -- user_options
delivery_status -- This seems to be a combination of user_options 
settings "1" and "2",  am I right?
topics_userinterest -- there is a topics_userinterest object which I'm 
not using.
delivery_status_timestamp - I don't see this listed in config.pck.  
Where is this?  I guess I'm not too worried about it as it seems like a 
temporary thing to do with bounces.

I'm skipping the following fields which store information about bounces 
as I'm fine with losing my bounce data.
bi_cookie
bi_score
bi_noticesleft
bi_lastnotice
bi_date




------------------------------------


BTW, I exported the pickle into JSON so I could use it in PHP.

Used a python script from:  
http://stackoverflow.com/questions/3040872/pythons-cpickle-deserialization-from-php


# pickle2json.py
import sys, optparse, cPickle, os
try:
     import json
except:
     import simplejson as json

# Setup the arguments this script can accept from the command line
parser = optparse.OptionParser()
parser.add_option('-p','--pickled_data_path',dest="pickled_data_path",type="string",help="Path 
to the file containing pickled data.")
parser.add_option('-j','--json_data_path',dest="json_data_path",type="string",help="Path 
to where the json data should be saved.")
opts,args=parser.parse_args()

# Load in the pickled data from either a file or the standard input stream
if opts.pickled_data_path:
     unpickled_data = cPickle.loads(open(opts.pickled_data_path).read())
else:
     unpickled_data = cPickle.loads(sys.stdin.read())

# Output the json version of the data either to another file or to the 
standard output
if opts.json_data_path:
     open(opts.json_data_path, 'w').write(json.dumps(unpickled_data))
else:
     print unpickled_data






More information about the Mailman-Developers mailing list