changeset 391:5026780c2dc7

- Fix HTTPError - Add wsgi script
author Matt Johnston <matt@ucc.asn.au>
date Wed, 11 Jul 2012 23:42:24 +0800
parents c0ffbfaac1c7
children 1a5f2449f760
files web/templog.py web/templog.wsgi
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/web/templog.py	Wed Jul 11 23:38:36 2012 +0800
+++ b/web/templog.py	Wed Jul 11 23:42:24 2012 +0800
@@ -23,7 +23,7 @@
     mac = request.forms.hmac
 
     if hmac.new(config.HMAC_KEY, enc_lines).hexdigest() != mac:
-        raise HTTPError(code = 403, output = "Bad key")
+        raise bottle.HTTPError(code = 403, output = "Bad key")
 
     lines = zlib.decompress(binascii.a2b_base64(enc_lines)).split('\n')
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/templog.wsgi	Wed Jul 11 23:42:24 2012 +0800
@@ -0,0 +1,12 @@
+import os
+import sys
+# Change working directory so relative paths (and template lookup) work again
+thisdir = os.path.dirname(__file__)
+os.chdir(thisdir)
+
+# for some reason local imports don't work...
+sys.path.append(thisdir)
+
+import bottle
+import templog
+application = bottle.default_app()