[ZPT] ZPT style question
Clemens Robbenhaar
zpt@zope.org
Tue, 1 Apr 2003 12:02:46 +0200
Hi Jean,
> Hi all
>
> In a product by a ZPT guru of note, I see code like this:
>
> """
> <init tal:omit-tag=""
> tal:define="global disable_delete python:1;
> global disable_move_up python:1;
> global disable_move_down python:1" />
> ...
> <content tal:replace="structure
> python:here.service_editor.renderElementsCache(request.node)" />
> """
>
> Points to ponder:
> 1) using a non-standard tag (init) and then discarding it
> (omit-tag) or replacing it (in the case of content).
> 2) always keeping the tal: namespace with the attributes,
> instead of moving it to the elements.
>
> Both snippets occur in the same template. Is there anything which
> makes that preferable above always writing:
>
> """
> <tal:init define="global disable_delete python:1;
> global disable_move_up python:1;
> global disable_move_down python:1" />
> ...
> <tal:content replace="structure
> python:here.service_editor.renderElementsCache(request.node)" />
> """
[...]
I can think of only one reason: the first version is covered by the
Zope Book and thus can be expected to be commonly known. The <tal:..>
notation is not so well documented and may look confusing to newbies.
Hm, the code looks very much like taken from the "Silva" product :-)
There has been a conclusion by the developers of this product to
switch to the latter version (i.e. <tal:foo> instead of <foo
tal:omit-tag="">) recently, but so far nobody did find the time to fix
all the code yet.
I do not think You have to worry about which form is "better", its a
matter of style IMHO.
Cheers,
Clemens