Changes between Version 3 and Version 4 of GenshiRecipes/WerkzeugWithGenshi
- Timestamp:
- Jul 23, 2008, 12:23:11 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GenshiRecipes/WerkzeugWithGenshi
v3 v4 5 5 == Templated Response class == 6 6 7 This class cuts back on the standard calls to load the template, generate a stream and populate it with data and subsequently render it. The data parameter is bestpassed as a dict.7 This class cuts back on the standard calls to load the template, generate a stream and populate it with data and subsequently render it. The data parameter is passed as a dict. 8 8 9 9 {{{ … … 30 30 TemplatedResponse.loader = TemplateLoader(TEMPLATES_DIR, auto_reload=True) 31 31 self.template = self.loader.load(template) 32 self.stream = self.template.generate( data=data)32 self.stream = self.template.generate(**data) 33 33 response = self.stream.render('xhtml', doctype=DocType.XHTML_STRICT) 34 34 Response.__init__(self, response) … … 41 41 return TemplatedResponse(template='my_template.html', data={'name': some_variable}) 42 42 }}} 43 44 and in the template itself you will use `name` with a simple `${name}` call.