Skip to content

Instantly share code, notes, and snippets.

/users.py Secret

Created June 9, 2015 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a0bebdac4245a564c1a5 to your computer and use it in GitHub Desktop.
Save anonymous/a0bebdac4245a564c1a5 to your computer and use it in GitHub Desktop.
Saaj CherryPy template override example
class Users:
@cherrypy.tools.template
def default(self, *args, **kwargs):
result = database.get(args[0])
if not result:
cherrypy.request.config['template'] = 'users/notfound.html'
return {'username': args[0]}
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment