-
-
Save anonymous/a0bebdac4245a564c1a5 to your computer and use it in GitHub Desktop.
Saaj CherryPy template override example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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