Mercurial > genshi > mirror
view examples/cherrypy/index.py @ 439:9f11c745fac9 trunk
Add support for adding custom template filters by passing a custom callback function to the `TemplateLoader`. Closes #89 (see added unit test).
author | cmlenz |
---|---|
date | Mon, 02 Apr 2007 19:43:31 +0000 |
parents | 406915754870 |
children |
line wrap: on
line source
import os import sys import cherrypy from genshi.template import TemplateLoader loader = TemplateLoader([os.path.dirname(os.path.abspath(__file__))]) class Example(object): @cherrypy.expose def index(self): tmpl = loader.load('index.html') return tmpl.generate(name='world').render('xhtml') if __name__ == '__main__': cherrypy.quickstart(Example(), config='config.txt')