Code

use config.DATABASE in cases where 'db' was still hard-coded
authorschlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2>
Mon, 8 Mar 2010 15:12:42 +0000 (15:12 +0000)
committerschlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2>
Mon, 8 Mar 2010 15:12:42 +0000 (15:12 +0000)
- in instance when determining the backend
- during init after nuking the db it would create 'db'

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

roundup/admin.py
roundup/init.py
roundup/instance.py

index 1b583e3196afa767ca89344abbc6a7e0733b28f3..511046df287691d90d12f80ac398ff1ff17cdbe3 100644 (file)
@@ -508,7 +508,7 @@ Erase it? Y/N: """))
             tracker.nuke()
 
             # re-write the backend select file
-            init.write_select_db(tracker_home, backend)
+            init.write_select_db(tracker_home, backend, tracker.config.DATABASE)
 
         # GO
         tracker.init(password.Password(adminpw))
index 7ecba91ef516ad7d261a828aa6e6dfd9f8dd374b..d4afecc9e8a50da5e33c7fc7d0dee6a3ff4e6918 100644 (file)
@@ -176,10 +176,12 @@ def saveTemplateInfo(dir, info):
     finally:
         f.close()
 
-def write_select_db(instance_home, backend):
+def write_select_db(instance_home, backend, dbdir = 'db'):
     ''' Write the file that selects the backend for the tracker
     '''
-    dbdir = os.path.join(instance_home, 'db')
+    # dbdir may be a relative pathname, os.path.join does the right
+    # thing when the second component of a join is an absolute path
+    dbdir = os.path.join (instance_home, dbdir)
     if not os.path.exists(dbdir):
         os.makedirs(dbdir)
     f = open(os.path.join(dbdir, 'backend_name'), 'w')
index 53fe56bfab597adca7079cbce956320aed2367a4..6b0f09a3b767dc7fab70e42ed515d32625d12fef 100644 (file)
@@ -81,7 +81,7 @@ class Tracker:
 
     def get_backend_name(self):
         o = __builtins__['open']
-        f = o(os.path.join(self.tracker_home, 'db', 'backend_name'))
+        f = o(os.path.join(self.config.DATABASE, 'backend_name'))
         name = f.readline().strip()
         f.close()
         return name