summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbdauvergne <bdauvergne@3ed937ae-f919-0410-9a43-8e6f19e4ba6e>2009-04-27 13:02:37 (GMT)
committerbdauvergne <bdauvergne@3ed937ae-f919-0410-9a43-8e6f19e4ba6e>2009-04-27 13:02:37 (GMT)
commite69a4ca86be5744f78335f57289f83842cbab3e3 (patch)
tree60474c4829d590ed352b203e235c488787a32717
parentf612aba869bc2f08c3ce17631c312ab56fc61ebc (diff)
downloadlarpe-e69a4ca86be5744f78335f57289f83842cbab3e3.zip
larpe-e69a4ca86be5744f78335f57289f83842cbab3e3.tar.gz
larpe-e69a4ca86be5744f78335f57289f83842cbab3e3.tar.bz2
Add stdandard command line options
* larpe/ctl/start.py: add standard options --http, --data-dir, --app-dir. --script-name cannot be used with http. git-svn-id: svn+ssh://labs.libre-entreprise.org/svnroot/larpe@471 3ed937ae-f919-0410-9a43-8e6f19e4ba6e
-rw-r--r--larpe/trunk/larpe/ctl/start.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/larpe/trunk/larpe/ctl/start.py b/larpe/trunk/larpe/ctl/start.py
index de41324..c404202 100644
--- a/larpe/trunk/larpe/ctl/start.py
+++ b/larpe/trunk/larpe/ctl/start.py
@@ -1,29 +1,47 @@
import socket
import sys
+import quixote.server.simple_server
from qommon.scgi_server import run
import publisher
def start(args):
- port = 3007
- script_name = ''
+ run_function = run
+ run_kwargs = {
+ 'port': 3007,
+ 'script_name': ''
+ }
+ http = 0
i = 0
while i < len(args):
if args[i] == '--port':
- port = int(args[i+1])
+ run_kwargs['port'] = int(args[i+1])
i += 1
elif args[i] == '--silent':
sys.stdout = open('/dev/null', 'w')
sys.stderr = open('/dev/null', 'w')
elif args[i] == '--script-name':
- script_name = args[i+1]
+ run_kwargs['script_name'] = args[i+1]
i += 1
+ elif args[i] == '--app-dir':
+ publisher.LarpePublisher.APP_DIR = args[i+1]
+ i += 1
+ elif args[i] == '--data-dir':
+ publisher.LarpePublisher.DATA_DIR = args[i+1]
+ i += 1
+ elif args[i] == '--http':
+ http = 1
i += 1
+ if http == 1:
+ run_function = quixote.server.simple_server.run
+ if run_kwargs['script_name']:
+ print "--http option is incompatible with --script-name"
+ del run_kwargs['script_name']
try:
- run(publisher.LarpePublisher.create_publisher, port=port, script_name=script_name)
+ run_function(publisher.LarpePublisher.create_publisher, **run_kwargs)
except socket.error, err:
if err[0] == 98:
print >> sys.stderr, 'address already in use'