Skip to content

Commit c97b167

Browse files
author
Richard Jones
committed
fix bsddb3 for 4.2.xx DB_TRUNCATE change
1 parent ba7e589 commit c97b167

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

roundup/backends/back_bsddb3.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_bsddb3.py,v 1.22 2004-02-11 23:55:08 richard Exp $
18+
#$Id: back_bsddb3.py,v 1.23 2004-05-05 01:17:42 richard Exp $
1919
'''This module defines a backend that saves the hyperdatabase in BSDDB3.
2020
'''
2121
__docformat__ = 'restructuredtext'
2222

23-
import bsddb3, os, marshal
23+
import bsddb3, os, marshal, errno
2424
from roundup import hyperdb, date
2525

2626
# these classes are so similar, we just use the anydbm methods
@@ -36,10 +36,12 @@ class Database(Database):
3636
#
3737
def clear(self):
3838
for cn in self.classes.keys():
39-
db = os.path.join(self.dir, 'nodes.%s'%cn)
40-
bsddb3.btopen(db, 'n')
41-
db = os.path.join(self.dir, 'journals.%s'%cn)
42-
bsddb3.btopen(db, 'n')
39+
for name in 'nodes.%s'%cn, 'journals.%s'%cn:
40+
try:
41+
os.remove(os.path.join(self.dir, name))
42+
except os.error, error:
43+
if error.errno != errno.ENOENT:
44+
raise
4345

4446
def getclassdb(self, classname, mode='r'):
4547
''' grab a connection to the class db that will be used for

0 commit comments

Comments
 (0)