diff roundup/backends/back_bsddb3.py @ 2251:01b5afc087ae

fix bsddb3 for 4.2.xx DB_TRUNCATE change
author Richard Jones <richard@users.sourceforge.net>
date Wed, 05 May 2004 01:17:42 +0000
parents fc52d57c6c3e
children 091711fb2f8c
line wrap: on
line diff
--- a/roundup/backends/back_bsddb3.py	Wed May 05 00:38:59 2004 +0000
+++ b/roundup/backends/back_bsddb3.py	Wed May 05 01:17:42 2004 +0000
@@ -15,12 +15,12 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-#$Id: back_bsddb3.py,v 1.22 2004-02-11 23:55:08 richard Exp $
+#$Id: back_bsddb3.py,v 1.23 2004-05-05 01:17:42 richard Exp $
 '''This module defines a backend that saves the hyperdatabase in BSDDB3.
 '''
 __docformat__ = 'restructuredtext'
 
-import bsddb3, os, marshal
+import bsddb3, os, marshal, errno
 from roundup import hyperdb, date
 
 # these classes are so similar, we just use the anydbm methods
@@ -36,10 +36,12 @@
     #
     def clear(self):
         for cn in self.classes.keys():
-            db = os.path.join(self.dir, 'nodes.%s'%cn)
-            bsddb3.btopen(db, 'n')
-            db = os.path.join(self.dir, 'journals.%s'%cn)
-            bsddb3.btopen(db, 'n')
+            for name in 'nodes.%s'%cn, 'journals.%s'%cn:
+                try:
+                    os.remove(os.path.join(self.dir, name))
+                except os.error, error:
+                    if error.errno != errno.ENOENT:
+                        raise
 
     def getclassdb(self, classname, mode='r'):
         ''' grab a connection to the class db that will be used for

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