Commit 16bd2f2b authored by Barry Warsaw's avatar Barry Warsaw

zodb_pickle(): Give the Pickler a persistent_id function so that it

acts more like what happens when you commit new object revisions using
the higher level interface.
parent 59d43ce0
......@@ -37,8 +37,12 @@ ZERO = '\0'*8
def zodb_pickle(obj):
"""Create a pickle in the format expected by ZODB."""
def persistent_id(obj):
return getattr(obj, '_p_oid', None)
f = StringIO()
p = Pickler(f, 1)
p.persistent_id = persistent_id
klass = obj.__class__
assert not hasattr(obj, '__getinitargs__'), "not ready for constructors"
args = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment