SV: [ZPT] extra_context

Magnus Heino magnus.heino@pleon.sigma.se
Tue, 4 Dec 2001 12:45:34 +0100


> > 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')

Suppose I want to use macros too, how would that fit in?

/Magnus