Dolda2000 GitWeb
/
ashd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
adb11d5
)
python: Added support to ashd.wsgidir for adding additional handlers.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Sat, 23 Oct 2010 06:38:53 +0000
(08:38 +0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Sat, 23 Oct 2010 06:38:53 +0000
(08:38 +0200)
python/ashd/wsgidir.py
patch
|
blob
|
blame
|
history
diff --git
a/python/ashd/wsgidir.py
b/python/ashd/wsgidir.py
index
e5dee72
..
5ce7638
100644
(file)
--- a/
python/ashd/wsgidir.py
+++ b/
python/ashd/wsgidir.py
@@
-65,6
+65,13
@@
def chain(path, env, startreq):
return wsgiutil.simpleerror(env, startreq, 500, "Internal Error", "Invalid WSGI handler.")
exts["wsgi"] = chain
return wsgiutil.simpleerror(env, startreq, 500, "Internal Error", "Invalid WSGI handler.")
exts["wsgi"] = chain
+def addext(ext, handler):
+ p = handler.rindex('.')
+ mname = handler[:p]
+ hname = handler[p + 1:]
+ mod = __import__(mname, fromlist = ["dummy"])
+ exts[ext] = getattr(mod, hname)
+
def application(env, startreq):
if not "SCRIPT_FILENAME" in env:
return wsgiutil.simpleerror(env, startreq, 500, "Internal Error", "The server is erroneously configured.")
def application(env, startreq):
if not "SCRIPT_FILENAME" in env:
return wsgiutil.simpleerror(env, startreq, 500, "Internal Error", "The server is erroneously configured.")
@@
-79,4
+86,8
@@
def application(env, startreq):
return(exts[ext](path, env, startreq))
def wmain(*argv):
return(exts[ext](path, env, startreq))
def wmain(*argv):
+ for arg in argv:
+ if arg[0] == '.':
+ p = arg.index('=')
+ addext(arg[1:p], arg[p + 1:])
return application
return application