[ZPT] extra_context

Evan Simpson evan@zope.com
Fri, 30 Nov 2001 09:56:09 -0500


Magnus Heino wrote:

> In the code below, what shoule bound_names be if I want the output to be
> "<p>content</p>" ??
> 
> p.write('<p tal:content="here/foo | default">bar</p>')
> 
> p(extra_context=bound_names)

The __call__ of PageTemplate puts all its arguments under "options" in the 
ZPT namespace, so what you really want is either:

my_here = {'foo': 'content'}
p.pt_render(extra_context={'here': my_here})

...or:

p.write('<p tal:content="options/foo | default">bar</p>')
p(foo='content')

Cheers,

Evan @ Zope