Aaron Kreider wrote:

>This worked.  Now I get a JSON error:
>
>File "pickle2json.py", line 21, in ?
>     open(opts.json_data_path, 'w').write(json.dumps(unpickled_data))
>   File "build/bdist.linux-x86_64/egg/simplejson/__init__.py", line 261, 
>in dumps
>   File "build/bdist.linux-x86_64/egg/simplejson/encoder.py", line 214, 
>in encode
>   File "build/bdist.linux-x86_64/egg/simplejson/encoder.py", line 282, 
>in iterencode
>   File "build/bdist.linux-x86_64/egg/simplejson/encoder.py", line 190, 
>in default
>TypeError: <bounce info for member [email protected]
>         current score: 1.0
>         last bounce date: (2007, 1, 8)
>         email notices left: 3
>         last notice date: (1970, 1, 1)
>         confirmation cookie: None
> > is not JSON serializable


The problem is that a member's bounce_info is an instance of the
Mailman.Bouncer._BounceInfo class (this is why your script needs to be
able to find the Mailman.Bouncer module to unpickle a list with
bounce_info).

JSON can't represent this class instance directly, just as
MysqlMemberships.py can't store it directly in the MySQL database.
This is why MysqlMemberships.py takes the class instances attributes
score, date, noticesleft, lastnotice and cookie and stores them as
separate fields bi_score, bi_date, bi_noticesleft, bi_lastnotice and
bi_cookie in the MySQL database table.

Your script needs to do a similar thing since it's the attribute values
you need to put in the database anyway.

-- 
Mark Sapiro <[email protected]>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

_______________________________________________
Mailman-Developers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9

Reply via email to