I am using Jinja2 with web.py and have come across what seems to be a simple problem. I am rendering my paramertized html files and can’t seem to figure out how to pass in multiple parameter=value pairs without typing each on in as arguments. I tried passing in a dict and list of strings with no success.
If I want to render home.html which has five parameters that need values, how can I pass in their values without having to type param1=value1, param2=value2 as arguments to the reder.home() function?
I was hoping something like this would work:
from web.contrib.template import render_jinja
render = render_jinja('templates', encoding = 'utf-8',)
p = {}
p['param1'] = 56
p['param2'] = 'something'
...
render.home(p)
PS. the web.py template examples seem to only cover the single param example.
You can use dictionary expansion, like so