[Zope3-dev] Re: tal:replace="default" question

Dmitry Vasiliev lists at hlabs.spb.ru
Sat May 14 03:14:40 EDT 2005


Evan Simpson wrote:
> Paul Winkler wrote:
> 
>>On Fri, May 13, 2005 at 05:39:56PM +0400, Dmitry Vasiliev wrote:
>>
>>
>>>'<span tal:content="default">42</span>'  =>  '<span>42</span>'
>>>'<span tal:replace="default">42</span>'  =>  '42'
>>
>>+1. IMHO the current behavior is wrong. "replace" should always replace
>>the element, no exceptions.
>>(Zope 2 has the same bug, I just checked.)
> 
> 
> You can certainly disagree with this behavior, but it is not a bug.
> 
> See http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AdvZPT.stx
> for example, which states that default is "A special value that doesn't
> change anything when used in tal:replace, tal:content, or
> tal:attributes. It leaves the template text in place."

But see also the "Omitting Tags" section for opposite examples:

"""
<b tal:omit-tag=""><i>this</i> stays</b>

Renders to:

<i>this</i> stays

At this level of usage, tal:omit-tag operates almost like tal:replace="default".
"""

Now in my Z3 sandbox 'tal:replace="value"' is just a syntactic sugar for 
'tal:content="value" tal:omit-tag=""' (I guess this is only the way to work 
around the "automatic msgid's translation" issue) so I've found the bug.

-- 
Dmitry Vasiliev (dima at hlabs.spb.ru)
     http://hlabs.spb.ru


More information about the Zope3-dev mailing list