diff roundup/backends/back_bsddb.py @ 570:e346a9792335

fixed back_bsddb so it passed the journal tests ... it didn't seem happy using the back_anydbm _open method, which is odd. Yet another occurrance of whichdb not being able to recognise older bsddb databases. Yadda yadda. Made the HYPERDBDEBUG stuff more sane in the process.
author Richard Jones <richard@users.sourceforge.net>
date Tue, 22 Jan 2002 07:21:13 +0000
parents de5bf4191f11
children 88acf6fe20a8
line wrap: on
line diff
--- a/roundup/backends/back_bsddb.py	Tue Jan 22 07:08:50 2002 +0000
+++ b/roundup/backends/back_bsddb.py	Tue Jan 22 07:21:13 2002 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-#$Id: back_bsddb.py,v 1.13 2001-12-10 22:20:01 richard Exp $
+#$Id: back_bsddb.py,v 1.14 2002-01-22 07:21:13 richard Exp $
 '''
 This module defines a backend that saves the hyperdatabase in BSDDB.
 '''
@@ -51,6 +51,24 @@
         else:
             return bsddb.btopen(path, 'n')
 
+    def _opendb(self, name, mode):
+        '''Low-level database opener that gets around anydbm/dbm
+           eccentricities.
+        '''
+        if hyperdb.DEBUG:
+            print self, '_opendb', (self, name, mode)
+        # determine which DB wrote the class file
+        path = os.path.join(os.getcwd(), self.dir, name)
+        if not os.path.exists(path):
+            if hyperdb.DEBUG:
+                print "_opendb bsddb.open(%r, 'n')"%path
+            return bsddb.btopen(path, 'n')
+
+        # open the database with the correct module
+        if hyperdb.DEBUG:
+            print "_opendb bsddb.open(%r, %r)"%(path, mode)
+        return bsddb.btopen(path, mode)
+
     #
     # Journal
     #
@@ -91,6 +109,13 @@
 
 #
 #$Log: not supported by cvs2svn $
+#Revision 1.13  2001/12/10 22:20:01  richard
+#Enabled transaction support in the bsddb backend. It uses the anydbm code
+#where possible, only replacing methods where the db is opened (it uses the
+#btree opener specifically.)
+#Also cleaned up some change note generation.
+#Made the backends package work with pydoc too.
+#
 #Revision 1.12  2001/11/21 02:34:18  richard
 #Added a target version field to the extended issue schema
 #

Roundup Issue Tracker: http://roundup-tracker.org/