On Apr 26, 2007, at 10:44 AM, Paul Winkler wrote:
On Thu, Apr 26, 2007 at 10:10:17AM -0400, Jim Fulton wrote:
On Apr 26, 2007, at 2:13 AM, Paul Winkler wrote:
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?
It is transforming the pickles by assigning new object ids to the
The unpickler unpickles the pickles into an internal format that can
be creates without actually creating the original objects. It
collects object ids and reassigns them. The pickler then turns the
internal data back into pickles with the new object ids.
This is done in 2 steps because database records consist of 2
pickles. The first has enough information to create a ghost. The
second pickle contains the object state.
Ah, thanks! So that means my import is succeeding with the ghost
and failing on object state.
Any ideas how to troubleshoot the failure in copy_reg.__newobj__?
Why is a pickle of an old-style extension class getting run through
copy_reg.__newobj__() which only works on new-style classes?
Old-style extension classes become new-style classes in Zope 2.8 and
later. Extension Classes *are* new stype classes in Zope 2.8 and
Jim Fulton mailto:[EMAIL PROTECTED] Python
CTO (540) 361-1714
Zope Corporation http://www.zope.com http://www.zope.org
For more information about ZODB, see the ZODB Wiki:
ZODB-Dev mailing list - ZODB-Dev@zope.org