changeset 4366:a0be2bc223f5

use config.DATABASE in cases where 'db' was still hard-coded - in instance when determining the backend - during init after nuking the db it would create 'db'
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Mon, 08 Mar 2010 15:12:42 +0000
parents 667c818f6a22
children fa5587802af9
files roundup/admin.py roundup/init.py roundup/instance.py
diffstat 3 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/admin.py	Fri Mar 05 15:51:11 2010 +0000
+++ b/roundup/admin.py	Mon Mar 08 15:12:42 2010 +0000
@@ -508,7 +508,7 @@
             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))
--- a/roundup/init.py	Fri Mar 05 15:51:11 2010 +0000
+++ b/roundup/init.py	Mon Mar 08 15:12:42 2010 +0000
@@ -176,10 +176,12 @@
     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')
--- a/roundup/instance.py	Fri Mar 05 15:51:11 2010 +0000
+++ b/roundup/instance.py	Mon Mar 08 15:12:42 2010 +0000
@@ -81,7 +81,7 @@
 
     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

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