Skip to content

Commit 301f83b

Browse files
author
Alexander Smishlajev
committed
if there is no config installed from the template, write default config text;
fix import statements; fix vim modeline
1 parent 65cad12 commit 301f83b

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

roundup/init.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414
# FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# 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 $
1919

2020
"""Init (create) a roundup instance.
2121
"""
2222
__docformat__ = 'restructuredtext'
2323

2424
import os, sys, errno, rfc822
2525

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
2829

2930
def copytree(src, dst, symlinks=0):
3031
"""Recursively copy a directory tree using copyDigestedFile().
@@ -94,6 +95,15 @@ def install(instance_home, template):
9495
ti['name'] = ti['name'] + '-' + os.path.split(instance_home)[1]
9596
saveTemplateInfo(instance_home, ti)
9697

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+
97107

98108
def listTemplates(dir):
99109
''' List all the Roundup template directories in a given directory.
@@ -170,4 +180,4 @@ def write_select_db(instance_home, backend):
170180

171181

172182

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

Comments
 (0)