[Zodb-checkins] CVS: StandaloneZODB/bsddb3Storage/bsddb3Storage - Full.py:1.40.2.4

Barry Warsaw barry@wooz.org
Wed, 19 Jun 2002 10:38:48 -0400


Update of /cvs-repository/StandaloneZODB/bsddb3Storage/bsddb3Storage
In directory cvs.zope.org:/tmp/cvs-serv28958

Modified Files:
      Tag: bsddb3Storage-picklelog-branch
	Full.py 
Log Message:
Comment out the Python 2.2 helper module and implement a Python-only
version of incr() for compatibility with Python 2.1.


=== StandaloneZODB/bsddb3Storage/bsddb3Storage/Full.py 1.40.2.3 => 1.40.2.4 ===
 #DNE = 'nonexist'                                  # does not exist
 
-import _helper
+# Python 2.2
+#from _helper import incr
+# Python 2.1
+def incr(refcount, delta):
+    return pack('>Q', unpack('>Q', refcount)[0] + delta)
+
 
 
 class Full(BerkeleyBase, ConflictResolvingStorage):
@@ -359,15 +364,12 @@
                 self._serials.put(oid, tid, txn=txn)
             for key, data in metadata:
                 self._metadata.put(key, data, txn=txn)
-            add = _helper.incr
             for roid, delta in refcounts.items():
                 refcount = self._refcounts.get(roid, ZERO, txn=txn)
-#                refcount = pack('>Q', unpack('>Q', refcount)[0] + delta)
-                self._refcounts.put(roid, add(refcount, delta), txn=txn)
+                self._refcounts.put(roid, incr(refcount, delta), txn=txn)
             for key, delta in picklerefcounts.items():
                 refcount = self._pickleRefcounts.get(key, ZERO, txn=txn)
-#                refcount = pack('>Q', unpack('>Q', refcount)[0] + delta)
-                self._pickleRefcounts.put(key, add(refcount, delta), txn=txn)
+                self._pickleRefcounts.put(key, incr(refcount, delta), txn=txn)
             # We're done with the picklelog
             self._picklelog.truncate(txn)
         except: