Code

Add clearCache method to DB.
authorgmcm <gmcm@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 26 Sep 2002 13:39:37 +0000 (13:39 +0000)
committergmcm <gmcm@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 26 Sep 2002 13:39:37 +0000 (13:39 +0000)
Create config.DATABASE directory if it doesn't exist.

git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1267 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/backends/back_metakit.py

index eeb93dbb5380be389127bb53d72d7f1476b14dac..e9a5fe204b29d81aa6f320fd9f754ca3f9be9b64 100755 (executable)
@@ -89,6 +89,9 @@ class _Database(hyperdb.Database):
             self.tables = self._db.view('tables')
             self.indexer.datadb = self._db
         self.dirty = 0
+    def clearCache(self):
+        for cl in self.classes.values():
+            cl._commit()
     def clear(self):
         for cl in self.classes.values():
             cl._clear()
@@ -181,6 +184,8 @@ class _Database(hyperdb.Database):
 
     # --- internal
     def __open(self):
+        if not os.path.exists(self.config.DATABASE):
+            os.makedirs(self.config.DATABASE)
         self.dbnm = db = os.path.join(self.config.DATABASE, 'tracker.mk4')
         lockfilenm = db[:-3]+'lck'
         self.lockfile = locking.acquire_lock(lockfilenm)