summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsean finey <seanius@debian.org>2009-02-12 19:16:15 +0100
committersean finey <seanius@debian.org>2009-02-12 19:16:15 +0100
commit34e51e2c294d26ca409b7210d230359b3df02b04 (patch)
tree51243b5e649d6bd25b805cf47b20045e6c259e03
parentaa62df8715ce930e473733ab0de0bc10ef6446d6 (diff)
downloadpatch-tracker-34e51e2c294d26ca409b7210d230359b3df02b04.tar.gz
more gracefully find what should be the installation root
-rwxr-xr-xpagehandler.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/pagehandler.py b/pagehandler.py
index f9a293d..d0f2c1b 100755
--- a/pagehandler.py
+++ b/pagehandler.py
@@ -9,13 +9,10 @@ import os
import sys
def application(env, resp):
- # the apache config sets a hint of where we are installed, which is
- # needed in mod_python since cwd is not automatically set
- try:
- sys.path+=[req.subprocess_env["PT_INSTALLROOT"]]
- os.chdir(req.subprocess_env["PT_INSTALLROOT"])
- except:
- pass
+ # everything is currently run relative to the pagehandler script.
+ whereami = os.path.dirname(env['SCRIPT_FILENAME'])
+ sys.path+=[whereami]
+ os.chdir(whereami)
import patchtracker.ReqHandler as ReqHandler
try:
@@ -27,6 +24,7 @@ def application(env, resp):
return ReqHandler.ErrorCmd(str(e), e.status).output()
if __name__ == '__main__':
+ os.environ['SCRIPT_FILENAME'] = sys.argv[0]
from wsgiref import simple_server as ss
print "pagehandler test server running..."
server = ss.WSGIServer( ('',8080), ss.WSGIRequestHandler)