From: schlatterbeck Date: Mon, 8 Mar 2010 15:12:42 +0000 (+0000) Subject: use config.DATABASE in cases where 'db' was still hard-coded X-Git-Url: https://git.tokkee.org/?p=roundup.git;a=commitdiff_plain;h=fce71c7148e3c0d3acb6f4195b7d541f9bc8dd0b 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' git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4472 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/admin.py b/roundup/admin.py index 1b583e3..511046d 100644 --- a/roundup/admin.py +++ b/roundup/admin.py @@ -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)) diff --git a/roundup/init.py b/roundup/init.py index 7ecba91..d4afecc 100644 --- a/roundup/init.py +++ b/roundup/init.py @@ -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') diff --git a/roundup/instance.py b/roundup/instance.py index 53fe56b..6b0f09a 100644 --- a/roundup/instance.py +++ b/roundup/instance.py @@ -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