[Zope-Checkins] CVS: ZODB/src/ZODB/zodb4 - conversion.py:1.1.2.8

Fred L. Drake, Jr. fred at zope.com
Wed Feb 18 16:25:29 EST 2004


Update of /cvs-repository/ZODB/src/ZODB/zodb4
In directory cvs.zope.org:/tmp/cvs-serv27023

Modified Files:
      Tag: zope3-zodb3-devel-branch
	conversion.py 
Log Message:
- use binary (protocol 1) pickles
- fix the check for new-args
- don't double pickle oids


=== ZODB/src/ZODB/zodb4/conversion.py 1.1.2.7 => 1.1.2.8 ===
--- ZODB/src/ZODB/zodb4/conversion.py:1.1.2.7	Fri Jan 30 16:45:03 2004
+++ ZODB/src/ZODB/zodb4/conversion.py	Wed Feb 18 16:25:29 2004
@@ -66,7 +66,7 @@
             classmeta = up.load()
             state = up.load()
             sio = StringIO()
-            p = Pickler(sio)
+            p = Pickler(sio, 1)
             p.persistent_id = get_persistent_id
             p.dump(classmeta)
             p.dump(state)
@@ -77,8 +77,8 @@
 class PersistentIdentifier:
     def __init__(self, ident):
         if isinstance(ident, tuple):
-            self._oid, self._class = ident
-            if isinstance(self._class, tuple):
+            self._oid, (self._class, args) = ident
+            if args:
                 # we have args from __getnewargs__(), but can just
                 # lose them since they're an optimization to allow
                 # ghost construction
@@ -92,11 +92,9 @@
 def get_persistent_id(ob):
     if isinstance(ob, PersistentIdentifier):
         if ob._class is None:
-            return dumps(ob._oid)
-        elif ob._args is not None:
-            raise RuntimeError("can't handle __new__ args")
+            return ob._oid
         else:
-            return dumps((ob._oid, ob._class))
+            return ob._oid, ob._class
     else:
         return None
 




More information about the Zope-Checkins mailing list