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 pickler.dump(unpickler.load()) pickler.dump(unpickler.load()) 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: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev