This is possible and I would not recommend using if statements in the template itself nor using low level Renoir because it will not work quite the same. Instead you can do:
from py4web.core import Template, action
def render_template(data, html):
context = dict(output=data)
Template(html).on_success(context)
return context['output']
@action('index')
def index():
d = dict(a='hello', b='world')
return render_template(d, 'generic.html')
Maybe I will add a method render_template to core that works like above.