Advertisement
Guest User

application.py

a guest
Oct 28th, 2014
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. # coding: utf-8
  2. import cherrypy
  3. import os.path
  4. import json
  5.  
  6. from mako.template import Template
  7. from mako.lookup import TemplateLookup
  8.  
  9. lookup = TemplateLookup(directories=['content'])
  10.  
  11. class Root:
  12. @cherrypy.expose
  13. def index(self):
  14. tmpl = lookup.get_template("index.html")
  15. return tmpl.render(**dict(username="Welcome"))
  16. #--------------------------------------
  17. class Application_cl(object):
  18. #--------------------------------------
  19. #----------------------------------
  20. def __init__(self):
  21. #--------------------------------------
  22. # constructor
  23. pass
  24.  
  25. #--------------------------------------
  26. def default(self, *arglist, **kwargs):
  27. #--------------------------------------
  28. msg_s = "unbekannte Anforderung: " + \
  29. str(arglist) + \
  30. ' ' + \
  31. str(kwargs)
  32. raise cherrypy.HTTPError(404, msg_s)
  33. default.exposed = True
  34. # EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement