Beispiel #1
0
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)
Beispiel #2
0
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)
Beispiel #3
0
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)
Beispiel #4
0
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)
Beispiel #5
0
 def testdefault(self):
     c.test = "This is in c var"
     return render_genshi('testgenshi.html')
Beispiel #6
0
 def testdefault(self):
     c.test = "This is in c var"
     return render_genshi('testgenshi.html')