[Zope] Re: page templates and "python:"

Tonico Strasser contact_tonico at yahoo.de
Mon Jul 3 09:50:41 EDT 2006


Claudio Battaglino schrieb:
> Hi,
> what does exactly happen when I use "python:" into a zpt?
> Is it a problem if I have many "python:" in my page templates?

Path expressions are by far better human readable IMHO. I try very hard 
to avoid Python expressions if possible.

To give you an example:

I prefer

<option tal:attributes="selected item/selected" ...

over

<option tal:attributes="python: test(foo == bar, 'selected', None)" ...

. But also because in the first example the template doesn't need to 
know about implementation details and thus it is better reusable e.g. as 
macro.

Tonico



More information about the Zope mailing list