Mercurial > genshi > genshi-test
annotate examples/cherrypy/index.py @ 351:50f4e199e3aa
The `py:content`, `py:replace`, and `py:strip=""` directives are now expanded when the template is loaded (as opposed to when it's rendered).
author | cmlenz |
---|---|
date | Fri, 10 Nov 2006 23:32:24 +0000 |
parents | aa16cebbcfe4 |
children | 3879c9ad3472 |
rev | line source |
---|---|
266 | 1 import os |
2 import sys | |
3 | |
4 import cherrypy | |
5 from genshi.template import TemplateLoader | |
6 | |
7 loader = TemplateLoader([os.path.dirname(os.path.abspath(__file__))]) | |
8 | |
9 | |
10 class Example(object): | |
11 | |
12 @cherrypy.expose | |
13 def index(self): | |
14 tmpl = loader.load('index.html') | |
15 return tmpl.generate(name='world').render('xhtml') | |
16 | |
17 | |
18 cherrypy.root = Example() | |
19 | |
20 if __name__ == '__main__': | |
21 cherrypy.config.update(file='config.txt') | |
22 cherrypy.server.start() |