1 import os, threading, types
6 cachelock = threading.Lock()
22 mod, mtime = modcache[path]
23 if sb.st_mtime <= mtime:
30 code = compile(text, path, "exec")
31 mod = types.ModuleType(mangle(path))
33 exec code in mod.__dict__
34 modcache[path] = mod, sb.st_mtime
39 def chain(path, env, startreq):
41 if hasattr(mod, "wmain"):
42 return (mod.wmain())(env, startreq)
43 elif hasattr(mod, "application"):
44 return mod.application(env, startreq)
45 return wsgiutil.simpleerror(env, startreq, 500, "Internal Error", "Invalid WSGI handler.")
48 def application(env, startreq):
49 if not "SCRIPT_FILENAME" in env:
50 return wsgiutil.simpleerror(env, startreq, 500, "Internal Error", "The server is erroneously configured.")
51 path = env["SCRIPT_FILENAME"]
52 base = os.path.basename(path)
54 if p < 0 or not os.access(path, os.R_OK):
55 return wsgiutil.simpleerror(env, startreq, 500, "Internal Error", "The server is erroneously configured.")
58 return wsgiutil.simpleerror(env, startreq, 500, "Internal Error", "The server is erroneously configured.")
59 return(exts[ext](path, env, startreq))