comparison roundup/init.py @ 2633:a9e1fff1e793

I thought I committed this last night. Ho hum. - This implements most of the rest of the new tracker config layout: - dbinit.py split between schema.py and initial_data.py - interfaces.py gone - tracker and detectors __init__.py gone - Added some missing functionality to backends: db_exists test and db_nuke. - Implemented configuration file options in postgresql backend. - Cleaned up tracker initialisation a lot.
author Richard Jones <richard@users.sourceforge.net>
date Tue, 27 Jul 2004 00:57:19 +0000
parents fc52d57c6c3e
children 4c08ca1e2460
comparison
equal deleted inserted replaced
2632:9c55f2bc5961 2633:a9e1fff1e793
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 # $Id: init.py,v 1.29 2004-02-11 23:55:08 richard Exp $ 18 # $Id: init.py,v 1.30 2004-07-27 00:57:18 richard Exp $
19 19
20 """Init (create) a roundup instance. 20 """Init (create) a roundup instance.
21 """ 21 """
22 __docformat__ = 'restructuredtext' 22 __docformat__ = 'restructuredtext'
23 23
157 f.close() 157 f.close()
158 158
159 def write_select_db(instance_home, backend): 159 def write_select_db(instance_home, backend):
160 ''' Write the file that selects the backend for the tracker 160 ''' Write the file that selects the backend for the tracker
161 ''' 161 '''
162 # now select database 162 dbdir = os.path.join(instance_home, 'db')
163 db = '''# WARNING: DO NOT EDIT THIS FILE!!! 163 if not os.path.exists(dbdir):
164 from roundup.backends.back_%s import Database, Class, FileClass, IssueClass 164 os.makedirs(dbdir)
165 '''%backend 165 f = open(os.path.join(dbdir, 'backend_name'), 'w')
166 open(os.path.join(instance_home, 'select_db.py'), 'w').write(db) 166 f.write(backend+'\n')
167 f.close()
167 168
168 169
169 def initialise(instance_home, adminpw):
170 '''Initialise an instance's database
171
172 adminpw - the password for the "admin" user
173 '''
174 # now import the instance and call its init
175 instance = roundup.instance.open(instance_home)
176 instance.init(password.Password(adminpw))
177 170
178 # vim: set filetype=python ts=4 sw=4 et si 171 # vim: set filetype=python ts=4 sw=4 et si

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