Paul Winkler wrote at 2007-4-26 02:13 -0400:
>In ExportImport._importDuringCommit() I found this little gem:
> 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()
>What's with the two load-and-dump lines near the end?
They effectively copy the data as a pickle to "newp" mapping the
persistent ids appropriately.
>If I switch from cPickle to Pickle, I get an extra two lines of
>Traceback (innermost last):
> Module ZPublisher.Publish, line 101, in publish
> Module ZPublisher.mapply, line 88, in mapply
> Module ZPublisher.Publish, line 39, in call_object
> Module OFS.ObjectManager, line 543, in manage_importObject
> Module OFS.ObjectManager, line 560, in _importObjectFromFile
> Module ZODB.ExportImport, line 86, in importFile
> Module ZODB.Transaction, line 241, in commit
> Module ZODB.Transaction, line 356, in _commit_objects
> Module ZODB.Connection, line 344, in commit
> Module ZODB.ExportImport, line 153, in _importDuringCommit
> Module pickle, line 872, in load
> Module pickle, line 1153, in load_reduce
> Module copy_reg, line 95, in __newobj__
Execute this in an interactive interpreter and check what "cls" in
"cls.__new__" is (using "pdb.pm()").
>Evidently, copy_reg.__newobj__() is for use with new-style classes.
>But that's weird, because the guy that gave me this .zexp says that it
>comes from a Zope 2.7 instance (Python 2.3, Plone 2.0) and I'm trying
>to load it into an instance with the same versions (he gave me a
>Products tarball too).
The python versions might differ.
For more information about ZODB, see the ZODB Wiki:
ZODB-Dev mailing list - ZODB-Dev@zope.org