diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-12-06 06:16:42 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-12-06 06:16:42 +0000 |
commit | 177fbc03cd0bb2a89bf87306d01c268b709bdf62 (patch) | |
tree | a43fd02583173732e092ebcf51deaa0010a58f93 /examples/wsgi | |
parent | 8e88f2eb3ab7d363e59bcd560df17e790d5a5b24 (diff) | |
download | mako-177fbc03cd0bb2a89bf87306d01c268b709bdf62.tar.gz |
cleaning up exception formatting
Diffstat (limited to 'examples/wsgi')
-rw-r--r-- | examples/wsgi/htdocs/index.html | 2 | ||||
-rw-r--r-- | examples/wsgi/run_wsgi.py | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/examples/wsgi/htdocs/index.html b/examples/wsgi/htdocs/index.html index cd0129e..79a5af2 100644 --- a/examples/wsgi/htdocs/index.html +++ b/examples/wsgi/htdocs/index.html @@ -1,5 +1,5 @@ <%inherit file="root.html"/> This is index.html - + c is ${c is not UNDEFINED and c or "undefined"} diff --git a/examples/wsgi/run_wsgi.py b/examples/wsgi/run_wsgi.py index cacd065..675c718 100644 --- a/examples/wsgi/run_wsgi.py +++ b/examples/wsgi/run_wsgi.py @@ -6,6 +6,7 @@ from mako import exceptions root = './' port = 8000 +error_style = 'html' # select 'text' for plaintext error reporting lookup = TemplateLookup(directories=[root + 'templates', root + 'htdocs'], filesystem_checks=True, module_directory='./modules') @@ -33,8 +34,12 @@ def serve(environ, start_response): start_response("404 Not Found", []) return ["Cant find template '%s'" % uri] except: - start_response("200 OK", [('Content-type','text/html')]) - return [exceptions.html_error_template().render()] + if error_style == 'text': + start_response("200 OK", [('Content-type','text/plain')]) + return [exceptions.text_error_template().render()] + else: + start_response("200 OK", [('Content-type','text/html')]) + return [exceptions.html_error_template().render()] else: u = re.sub(r'^\/+', '', uri) filename = os.path.join(root, u) |