Code

- fix mailgw list of methods -- use getattr so that a derived class will
[roundup.git] / demo.py
diff --git a/demo.py b/demo.py
index acaa13c8b785062b57690df663cb05b84ac70b84..0cc4a38af39abf37d96675c7b351d4528ecc3a99 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()
 
@@ -110,7 +115,7 @@ Demo tracker is set up to be accessed by localhost browser.  If you
 run demo on a server host, please stop the demo, open file
 "demo/config.ini" with your editor, change the host name in the "web"
 option in section "[tracker]", save the file, then re-run the demo
-program.
+program. If you want to change backend types, you must use "nuke".
 
 ''' % url