Commit 288f536f authored by Barry Warsaw's avatar Barry Warsaw

zodb_pickle(): Use a lambda for convenience.

parent eeef9cff
...@@ -37,12 +37,9 @@ ZERO = '\0'*8 ...@@ -37,12 +37,9 @@ ZERO = '\0'*8
def zodb_pickle(obj): def zodb_pickle(obj):
"""Create a pickle in the format expected by ZODB.""" """Create a pickle in the format expected by ZODB."""
def persistent_id(obj):
return getattr(obj, '_p_oid', None)
f = StringIO() f = StringIO()
p = Pickler(f, 1) p = Pickler(f, 1)
p.persistent_id = persistent_id p.persistent_id = lambda obj: getattr(obj, '_p_oid', None)
klass = obj.__class__ klass = obj.__class__
assert not hasattr(obj, '__getinitargs__'), "not ready for constructors" assert not hasattr(obj, '__getinitargs__'), "not ready for constructors"
args = None 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