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.
kit


--
kit BLAKE
Infrae · infrae.com · +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.

/JM
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to