diff roundup/backends/back_anydbm.py @ 2736:402d6d556558

postgres backend open doesn't hide corruption in schema [SF#956375] *dbm-style backends nuke() method now clear id counters
author Richard Jones <richard@users.sourceforge.net>
date Fri, 08 Oct 2004 05:37:44 +0000
parents 2f5bf63a4b2c
children 2eae5848912d
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py	Fri Oct 08 01:58:43 2004 +0000
+++ b/roundup/backends/back_anydbm.py	Fri Oct 08 05:37:44 2004 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 #
-#$Id: back_anydbm.py,v 1.172 2004-09-29 07:09:13 a1s Exp $
+#$Id: back_anydbm.py,v 1.173 2004-10-08 05:37:44 richard Exp $
 '''This module defines a backend that saves the hyperdatabase in a
 database chosen by anydbm. It is guaranteed to always be available in python
 versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -46,12 +46,12 @@
 def db_exists(config):
     # check for the user db
     for db in 'nodes.user nodes.user.db'.split():
-        if os.path.exists(os.path.join(config.TRACKER_HOME, 'db', db)):
+        if os.path.exists(os.path.join(config.DATABASE, db)):
             return 1
     return 0
 
 def db_nuke(config):
-    shutil.rmtree(os.path.join(config.TRACKER_HOME, 'db'))
+    shutil.rmtree(config.DATABASE)
 
 #
 # Now the database
@@ -185,6 +185,12 @@
                     os.remove(path)
                 elif os.path.exists(path+'.db'):    # dbm appends .db
                     os.remove(path+'.db')
+        # reset id sequences
+        path = os.path.join(os.getcwd(), self.dir, '_ids')
+        if os.path.exists(path):
+            os.remove(path)
+        elif os.path.exists(path+'.db'):    # dbm appends .db
+            os.remove(path+'.db')
 
     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/