kit BLAKE wrote:

In 'normal' tal we often refactor our defines to improve efficiency.
When something is called more than once in a template, we define it at
the beginning, and then use it multiple times. This improves
performance dramatically of course.

Infrae · · +31 10 243 7051
Hoevestraat 10 · 3033GC · Rotterdam · The Netherlands

In that case it's fine because the modifications of the data structure are "local" inside the template. The data structure rendered by the view does not get modified. Ideally you can always prepare the data structure so that it already contains inside a dictionary the results you want to display , it is always possible to do it.

however it is not OK when things start looking like:

tal:define="dummy python: context['item'] == sometool.getNewData()"

and the context or the request gets overridden.

Templates are not supposed to exchange data directly with one another. I reckon that if "tal:define" is used, then the template should not have write-access to the data model at all.

Zope3-dev mailing list

Reply via email to