[ZODB-Dev] What causes a persistent object to be "broken"?

kw kw_odonian at yahoo.com
Fri Mar 4 12:21:56 EST 2005


Hi Dieter, Tim,

Yes, you are both correct - once the "broken" class is
actually defined in the __main__ namespace, things
work just fine.  Thank you very much for the help, it
saved me much frustration.  Now hopefully google will
pick up this thread and help other ZODB users... :-)

kw

--- Dieter Maurer <dieter at handshake.de> wrote:

> kw wrote at 2005-3-2 21:25 -0800:
> >I'm using a PersistentMapping and have noticed that
> >one of the mappings shows the following, after
> >creating and committing a one item mapping:
> >
> >{u'test_system': <persistent broken __main__.System
> >instance '\x00\x00\x00\x00\x00\x00\x00\x1a'>}
> >
> >Here __main__.System is a custom datatype that's a
> >composite of smaller objects, that are themselves
> >persistent.
> 
> Almost surely, "__main__" no longer defines
> "System".
> 
> Note that "__main__" depends on the script you are
> calling.
> 
> It is usually not a good idea to define persitent
> classes in
> the main module.
> 
> -- 
> Dieter
> 



More information about the ZODB-Dev mailing list