-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patherror.py
More file actions
34 lines (28 loc) · 853 Bytes
/
error.py
File metadata and controls
34 lines (28 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 coding=utf-8
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
import os
from google.appengine.ext.webapp import template
class ErrorPage(webapp.RequestHandler):
def get(self):
doRender(self, 'error.html', { })
# A render helper
def doRender(handler, tname, values = { }):
temp = os.path.join(
os.path.dirname(__file__),
'templates/' + tname)
if not os.path.isfile(temp):
return False
newval = dict(values)
outstr = template.render(temp, newval)
handler.response.out.write(outstr)
return True
application = webapp.WSGIApplication([
('/.*', ErrorPage)],
debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()