def render_genshi(template_name, template_vars, **kwargs): """Render the template_vars with the Genshi template""" template_vars['XML'] = XML if config.get('use_dotted_templatenames', False): template_name = tg.config[ 'pylons.app_globals'].dotted_filename_finder.get_dotted_filename( template_name, template_extension='.html') return templating.render_genshi(template_name, extra_vars=template_vars, **kwargs)
def render_chameleon_genshi(template_name, template_vars, **kwargs): """Render the template_vars with the chameleon.genshi template""" template_vars['XML'] = XML if config.get('use_dotted_templatenames', False): template_name = tg.config[ 'pylons.app_globals'].dotted_filename_finder.get_dotted_filename( template_name, template_extension='.html') # here we use the render genshi function because it should be api compliant return templating.render_genshi(template_name, extra_vars=template_vars, **kwargs)
def render_genshi(template_name, template_vars, **kwargs): """Render the template_vars with the Genshi template""" global HTML,XML if not HTML or not XML: from genshi import HTML,XML template_vars.update(HTML=HTML, XML=XML) if config.get('use_dotted_templatenames', False): template_name = tg.config['pylons.app_globals' ].dotted_filename_finder.get_dotted_filename( template_name, template_extension='.html') if 'method' not in kwargs and 'templating.genshi.method' in config: kwargs['method'] = config['templating.genshi.method'] # (in a similar way, we could pass other serialization options when they # will be supported - see http://pylonshq.com/project/pylonshq/ticket/613) return templating.render_genshi(template_name, extra_vars=template_vars, **kwargs)
def render_genshi(template_name, template_vars, **kwargs): """Render the template_vars with the Genshi template""" global HTML, XML if not HTML or not XML: from genshi import HTML, XML template_vars.update(HTML=HTML, XML=XML) if config.get('use_dotted_templatenames', False): template_name = tg.config[ 'pylons.app_globals'].dotted_filename_finder.get_dotted_filename( template_name, template_extension='.html') if 'method' not in kwargs: kwargs['method'] = { 'text/xml': 'xml', 'text/plain': 'text' }.get(response.content_type, config.get('templating.genshi.method')) # (in a similar way, we could pass other serialization options when they # will be supported - see http://pylonshq.com/project/pylonshq/ticket/613) return templating.render_genshi(template_name, extra_vars=template_vars, **kwargs)
def testdefault(self): c.test = "This is in c var" return render_genshi('testgenshi.html')