I have a Jinja2 dictionary and I want a single expression that modifies it - either by changing its content, or merging with another dictionary.
>>>
I added a filter to merge dictionaries, namely:
>>> def add_to_dict(x,y): return dict(x, **y) >>> e.filters['add_to_dict'] = add_to_dict >>> e.from_string("{{ x|add_to_dict({4:5}) }}").render({'x':{1:2,2:3}}) u'{1: 2, 2: 3, 4: 5}'