[Zodb-checkins] CVS: ZODB4/src/zodb/storage - base.py:1.6

Barry Warsaw barry@wooz.org
Wed, 22 Jan 2003 14:21:09 -0500


Update of /cvs-repository/ZODB4/src/zodb/storage
In directory cvs.zope.org:/tmp/cvs-serv9198

Modified Files:
	base.py 
Log Message:
Forward port from ZODB 3.2:

Use ZERO where appropriate

Add a flag ``berkeley_is_available`` which is true if Python 2.3 or
2.2.2 (distutils) BerkeleyDB wrapper is available.  Various BDB
storage tests check this flag before adding tests it knows will fail.



=== ZODB4/src/zodb/storage/base.py 1.5 => 1.6 ===
--- ZODB4/src/zodb/storage/base.py:1.5	Tue Dec 31 11:05:06 2002
+++ ZODB4/src/zodb/storage/base.py	Wed Jan 22 14:21:06 2003
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2001 Zope Corporation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -34,8 +34,10 @@
         from bsddb import _db as db
     except ImportError:
         from bsddb3 import db
+    berkeley_is_available = True
 except ImportError:
     db = None
+    berkeley_is_available = False
 
 from zodb import interfaces
 from zodb.timestamp import newTimeStamp, TimeStamp
@@ -582,7 +584,7 @@
         if value:
             self._oid = value[0]
         else:
-            self._oid = '\0\0\0\0\0\0\0\0'
+            self._oid = ZERO
 
     # It can be very expensive to calculate the "length" of the database, so
     # we cache the length and adjust it as we add and remove objects.
@@ -693,6 +695,7 @@
         self._env.close()
         os.unlink(lockfile)
 
+    # A couple of convenience methods
     def _update(self, deltas, data, incdec):
         for oid in findrefs(data):
             rc = deltas.get(oid, 0) + incdec