[Zope3-checkins] CVS: Zope3/src/zodb/storage - base.py:1.23

Barry Warsaw barry@wooz.org
Fri, 21 Mar 2003 11:42:46 -0500


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

Modified Files:
	base.py 
Log Message:
Fix Python 2.2 no-bsddb compatibility;

- add DB_FORCE
- be sure exception classes DBNotFoundError and DBKeyEmpty are classic
  classes.


=== Zope3/src/zodb/storage/base.py 1.22 => 1.23 ===
--- Zope3/src/zodb/storage/base.py:1.22	Thu Mar 20 17:54:19 2003
+++ Zope3/src/zodb/storage/base.py	Fri Mar 21 11:42:45 2003
@@ -25,6 +25,7 @@
 import struct
 import threading
 import logging
+from types import ClassType
 
 # In Python 2.3, we can simply use the bsddb module, but for Python 2.2, we
 # need to use pybsddb3, a.k.a. bsddb3.
@@ -41,9 +42,16 @@
     class db:
         DB_QUEUE = 1
         DB_DUP = 2
+        DB_FORCE = 3
 
-        class DBNotFoundError: pass
-        class DBKeyEmpty: pass
+        # These are exceptions and thus must be classic classes
+        class DBNotFoundError:
+            __metaclass__ = ClassType
+            pass
+
+        class DBKeyEmpty:
+            __metaclass__ = ClassType
+            pass
 
 
 from zodb.conflict import ConflictResolver