Code

Adjust to allow to run the 'minimal' tracker, too.
authorstefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 17 Jun 2009 15:24:08 +0000 (15:24 +0000)
committerstefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 17 Jun 2009 15:24:08 +0000 (15:24 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4228 57a73879-2fb5-44c3-a270-3262357dd7e2

demo.py

diff --git a/demo.py b/demo.py
index acaa13c8b785062b57690df663cb05b84ac70b84..20f9f1285f1d831fa333f022a93794a14fabe873 100644 (file)
--- a/demo.py
+++ b/demo.py
@@ -49,12 +49,12 @@ def install_demo(home, backend, template):
     template_dir = os.path.join('share', 'roundup', 'templates', template)
     init.install(home, template_dir)
     # don't have email flying around
-    os.remove(os.path.join(home, 'detectors', 'nosyreaction.py'))
-    try:
-        os.remove(os.path.join(home, 'detectors', 'nosyreaction.pyc'))
-    except os.error, error:
-        if error.errno != errno.ENOENT:
-            raise
+    nosyreaction = os.path.join(home, 'detectors', 'nosyreaction.py')
+    if os.path.exists(nosyreaction):
+        os.remove(nosyreaction)
+    nosyreaction += 'c'
+    if os.path.exists(nosyreaction):
+        os.remove(nosyreaction)
     init.write_select_db(home, backend)
 
     # figure basic params for server
@@ -88,8 +88,13 @@ def install_demo(home, backend, template):
 
     # add the "demo" user
     db = tracker.open('admin')
-    db.user.create(username='demo', password=password.Password('demo'),
-        realname='Demo User', roles='User')
+    # FIXME: Move tracker-specific demo initialization into the tracker templates.
+    if (template == 'minimal'):
+        db.user.create(username='demo', password=password.Password('demo'),
+                       roles='User')
+    else:
+        db.user.create(username='demo', password=password.Password('demo'),
+                       realname='Demo User', roles='User')
     db.commit()
     db.close()