Code

- Remove implementations of Class.getnode from back_anydbm and rdbms_common,
[roundup.git] / demo.py
diff --git a/demo.py b/demo.py
index c840be6ea4177ee35cf303ba2fee0986a58477bd..2a5c95780cf3f472ba8dbdb64a5a599cb5b2ce7c 100644 (file)
--- a/demo.py
+++ b/demo.py
@@ -2,7 +2,7 @@
 #
 # Copyright (c) 2003 Richard Jones (richard@mechanicalcat.net)
 # 
-# $Id: demo.py,v 1.4 2003-07-27 23:16:33 richard Exp $
+# $Id: demo.py,v 1.7 2003-11-06 14:24:57 jlgijsbers Exp $
 
 import sys, os, string, re, urlparse
 import shutil, socket, errno, BaseHTTPServer
@@ -16,7 +16,11 @@ def install_demo(home):
     init.install(home, os.path.join('templates', 'classic'))
     # don't have email flying around
     os.remove(os.path.join(home, 'detectors', 'nosyreaction.py'))
-    os.remove(os.path.join(home, 'detectors', 'nosyreaction.pyc'))
+    try:
+        os.remove(os.path.join(home, 'detectors', 'nosyreaction.pyc'))
+    except os.error, error:
+        if error.errno != errno.ENOENT:
+            raise
     init.write_select_db(home, 'anydbm')
 
     # figure basic params for server
@@ -77,18 +81,18 @@ def run_demo():
     port = int(port)
 
     # ok, so start up the server
-    from roundup.scripts.roundup_server import RoundupRequestHandler
-    RoundupRequestHandler.TRACKER_HOMES = {'demo': home}
-    httpd = BaseHTTPServer.HTTPServer((hostname, port), RoundupRequestHandler)
-    print 'Server running - connect to:\n  %s'%url
-    print '1. Log in as "demo"/"demo" or "admin"/"admin".'
-    print '2. Hit Control-C to stop the server.'
-    print '3. Re-start the server by running "python demo.py" again.'
-    print '4. Re-initialise the server by running "python demo.py nuke".'
-    try:
-        httpd.serve_forever()
-    except KeyboardInterrupt:
-        print 'Keyboard Interrupt: exiting'
+    from roundup.scripts import roundup_server
+    roundup_server.RoundupRequestHandler.TRACKER_HOMES = {'demo': home}
+
+    success_message = '''Server running - connect to:
+    %s
+1. Log in as "demo"/"demo" or "admin"/"admin".
+2. Hit Control-C to stop the server.
+3. Re-start the server by running "python demo.py" again.
+4. Re-initialise the server by running "python demo.py nuke".''' % url
+
+    sys.argv = sys.argv[:1]
+    roundup_server.run(port, success_message)
 
 if __name__ == '__main__':
     run_demo()