Mercurial > p > roundup > code
comparison demo.py @ 2837:bcee075321fc
patching roundup_server.RoundupRequestHandler class directly...
...does not work anymore. use sys.argv to pass the tracker spec
and port number to roundup_server.run()
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Fri, 29 Oct 2004 15:55:16 +0000 |
| parents | 5f62f3dd5aa8 |
| children | adec352e2ce0 |
comparison
equal
deleted
inserted
replaced
| 2836:473d2323bc9d | 2837:bcee075321fc |
|---|---|
| 1 #! /usr/bin/env python | 1 #! /usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2003 Richard Jones (richard@mechanicalcat.net) | 3 # Copyright (c) 2003 Richard Jones (richard@mechanicalcat.net) |
| 4 # | 4 # |
| 5 # $Id: demo.py,v 1.20 2004-10-19 08:04:12 a1s Exp $ | 5 # $Id: demo.py,v 1.21 2004-10-29 15:55:16 a1s Exp $ |
| 6 | 6 |
| 7 import errno | 7 import errno |
| 8 import os | 8 import os |
| 9 import socket | 9 import socket |
| 10 import sys | 10 import sys |
| 90 db.commit() | 90 db.commit() |
| 91 db.close() | 91 db.close() |
| 92 | 92 |
| 93 def run_demo(home): | 93 def run_demo(home): |
| 94 """Run the demo tracker installed in ``home``""" | 94 """Run the demo tracker installed in ``home``""" |
| 95 roundup_server.RoundupRequestHandler.TRACKER_HOMES = {'demo': home} | |
| 96 cfg = configuration.CoreConfig(home) | 95 cfg = configuration.CoreConfig(home) |
| 97 url = cfg["TRACKER_WEB"] | 96 url = cfg["TRACKER_WEB"] |
| 98 hostname, port = urlparse.urlparse(url)[1].split(':') | 97 hostname, port = urlparse.urlparse(url)[1].split(':') |
| 99 port = int(port) | 98 port = int(port) |
| 100 success_message = '''Server running - connect to: | 99 success_message = '''Server running - connect to: |
| 104 3. Re-start the server by running "python demo.py" again. | 103 3. Re-start the server by running "python demo.py" again. |
| 105 4. Re-initialise the server by running "python demo.py nuke". | 104 4. Re-initialise the server by running "python demo.py nuke". |
| 106 ''' % url | 105 ''' % url |
| 107 | 106 |
| 108 # disable command line processing in roundup_server | 107 # disable command line processing in roundup_server |
| 109 sys.argv = sys.argv[:1] | 108 sys.argv = sys.argv[:1] + ['-p', str(port), 'demo=' + home] |
| 110 roundup_server.run(port=port, success_message=success_message) | 109 roundup_server.run(success_message=success_message) |
| 111 | 110 |
| 112 def demo_main(): | 111 def demo_main(): |
| 113 """Run a demo server for users to play with for instant gratification. | 112 """Run a demo server for users to play with for instant gratification. |
| 114 | 113 |
| 115 Sets up the web service on localhost. Disables nosy lists. | 114 Sets up the web service on localhost. Disables nosy lists. |
