On Aug 15, 2007, at 9:34 AM, Christian Theune wrote:

            pfile = StringIO(data)
            unpickler = Unpickler(pfile)
            unpickler.persistent_load = persistent_load

            newp = StringIO()
            pickler = Pickler(newp, 1)
            pickler.persistent_id = persistent_id

            data = newp.getvalue()

Why do we call pickler.dump(unpickler.load()) twice?

Just a guess, but I think it is because the original data record is actually
the concatenation of two pickles, the first for the class (or something
like that) and the second is the actual pickled object state.
It looks like this code extracts the pickled state from the record.

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to