|
14 | 14 | # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | | -# |
18 | | -# $Id: init.py,v 1.31 2004-09-29 07:13:44 richard Exp $ |
| 17 | +# |
| 18 | +# $Id: init.py,v 1.32 2004-10-16 14:45:12 a1s Exp $ |
19 | 19 |
|
20 | 20 | """Init (create) a roundup instance. |
21 | 21 | """ |
22 | 22 | __docformat__ = 'restructuredtext' |
23 | 23 |
|
24 | 24 | import os, sys, errno, rfc822 |
25 | 25 |
|
26 | | -import roundup.instance, password |
27 | | -from roundup import install_util |
| 26 | +import roundup.instance |
| 27 | +from roundup import install_util, password |
| 28 | +from roundup.configuration import CoreConfig |
28 | 29 |
|
29 | 30 | def copytree(src, dst, symlinks=0): |
30 | 31 | """Recursively copy a directory tree using copyDigestedFile(). |
@@ -94,6 +95,15 @@ def install(instance_home, template): |
94 | 95 | ti['name'] = ti['name'] + '-' + os.path.split(instance_home)[1] |
95 | 96 | saveTemplateInfo(instance_home, ti) |
96 | 97 |
|
| 98 | + # if there is no config.ini or old-style config.py |
| 99 | + # installed from the template, write default config text |
| 100 | + config_ini_file = os.path.join(instance_home, CoreConfig.INI_FILE) |
| 101 | + if not (os.path.isfile(config_ini_file) |
| 102 | + or os.path.isfile(os.path.join(instance_home, 'config.py')) |
| 103 | + ): |
| 104 | + config = CoreConfig() |
| 105 | + config.save(config_ini_file) |
| 106 | + |
97 | 107 |
|
98 | 108 | def listTemplates(dir): |
99 | 109 | ''' List all the Roundup template directories in a given directory. |
@@ -170,4 +180,4 @@ def write_select_db(instance_home, backend): |
170 | 180 |
|
171 | 181 |
|
172 | 182 |
|
173 | | -# vim: set filetype=python ts=4 sw=4 et si |
| 183 | +# vim: set filetype=python sts=4 sw=4 et si : |
0 commit comments