Dolda2000 GitWeb
/
ashd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bumped version number.
[ashd.git]
/
python
/
scgi-wsgi
diff --git
a/python/scgi-wsgi
b/python/scgi-wsgi
index
9befb25
..
e2689d4
100755
(executable)
--- a/
python/scgi-wsgi
+++ b/
python/scgi-wsgi
@@
-1,23
+1,27
@@
-#!/usr/bin/python
3
+#!/usr/bin/python
-import sys, os, getopt
+import sys, os, getopt
, logging
import socket
import ashd.scgi
def usage(out):
import socket
import ashd.scgi
def usage(out):
- out.write("usage: scgi-wsgi [-hA] [-p MODPATH] [-T [HOST:]PORT] HANDLER-MODULE [ARGS...]\n")
+ out.write("usage: scgi-wsgi [-hA
L
] [-p MODPATH] [-T [HOST:]PORT] HANDLER-MODULE [ARGS...]\n")
sk = None
modwsgi_compat = False
sk = None
modwsgi_compat = False
-opts, args = getopt.getopt(sys.argv[1:], "+hAp:T:")
+setlog = True
+opts, args = getopt.getopt(sys.argv[1:], "+hALp:T:")
for o, a in opts:
if o == "-h":
usage(sys.stdout)
sys.exit(0)
elif o == "-p":
sys.path.insert(0, a)
for o, a in opts:
if o == "-h":
usage(sys.stdout)
sys.exit(0)
elif o == "-p":
sys.path.insert(0, a)
+ elif o == "-L":
+ setlog = False
elif o == "-T":
sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
elif o == "-T":
sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ sk.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
p = a.rfind(":")
if p < 0:
bindhost = "localhost"
p = a.rfind(":")
if p < 0:
bindhost = "localhost"
@@
-32,6
+36,8
@@
for o, a in opts:
if len(args) < 1:
usage(sys.stderr)
sys.exit(1)
if len(args) < 1:
usage(sys.stderr)
sys.exit(1)
+if setlog:
+ logging.basicConfig(format="scgi-wsgi(%(name)s): %(levelname)s: %(message)s")
if sk is None:
# This is suboptimal, since the socket on stdin is not necessarily
if sk is None:
# This is suboptimal, since the socket on stdin is not necessarily
@@
-41,8
+47,8
@@
if sk is None:
try:
handlermod = __import__(args[0], fromlist = ["dummy"])
try:
handlermod = __import__(args[0], fromlist = ["dummy"])
-except ImportError
as
exc:
- sys.stderr.write("scgi-wsgi: handler %s not found: %s\n" % (args[0], exc.
args[0]
))
+except ImportError
,
exc:
+ sys.stderr.write("scgi-wsgi: handler %s not found: %s\n" % (args[0], exc.
message
))
sys.exit(1)
if not modwsgi_compat:
if not hasattr(handlermod, "wmain"):
sys.exit(1)
if not modwsgi_compat:
if not hasattr(handlermod, "wmain"):