changeset 2766:b2cd472919c8

if there is no config installed from the template, write default config text; fix import statements; fix vim modeline
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Sat, 16 Oct 2004 14:45:12 +0000
parents 3468f74bd7ce
children f6072f395f87
files roundup/init.py
diffstat 1 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/init.py	Sat Oct 16 13:31:29 2004 +0000
+++ b/roundup/init.py	Sat Oct 16 14:45:12 2004 +0000
@@ -14,8 +14,8 @@
 # FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-# 
-# $Id: init.py,v 1.31 2004-09-29 07:13:44 richard Exp $
+#
+# $Id: init.py,v 1.32 2004-10-16 14:45:12 a1s Exp $
 
 """Init (create) a roundup instance.
 """
@@ -23,8 +23,9 @@
 
 import os, sys, errno, rfc822
 
-import roundup.instance, password
-from roundup import install_util
+import roundup.instance
+from roundup import install_util, password
+from roundup.configuration import CoreConfig
 
 def copytree(src, dst, symlinks=0):
     """Recursively copy a directory tree using copyDigestedFile().
@@ -94,6 +95,15 @@
     ti['name'] = ti['name'] + '-' + os.path.split(instance_home)[1]
     saveTemplateInfo(instance_home, ti)
 
+    # if there is no config.ini or old-style config.py
+    # installed from the template, write default config text
+    config_ini_file = os.path.join(instance_home, CoreConfig.INI_FILE)
+    if not (os.path.isfile(config_ini_file)
+        or os.path.isfile(os.path.join(instance_home, 'config.py'))
+    ):
+        config = CoreConfig()
+        config.save(config_ini_file)
+
 
 def listTemplates(dir):
     ''' List all the Roundup template directories in a given directory.
@@ -170,4 +180,4 @@
 
 
 
-# vim: set filetype=python ts=4 sw=4 et si
+# vim: set filetype=python sts=4 sw=4 et si :

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