Hi, Is it possible to write a tag that can be used with and without closing tag? <dtml-translate>...</dtml-translate> or <dtml-translate ...> Thanks, david
"Ibañez Palomar Juan David" wrote:
Hi,
Is it possible to write a tag that can be used with and without closing tag?
<dtml-translate>...</dtml-translate>
or
<dtml-translate ...>
I *think* you can, your tags __init__ method will be called with a blocks sequence that will contain one block in the first case and zero in the second. Just don't go looking for any blocks in the second case and I bet it would work. But it might not... -Michel
"Ibañez Palomar Juan David" wrote:
Hi,
Is it possible to write a tag that can be used with and without closing tag?
<dtml-translate>...</dtml-translate>
or
<dtml-translate ...>
I *think* you can, your tags __init__ method will be called with a blocks sequence that will contain one block in the first case and zero in the second.
Just don't go looking for any blocks in the second case and I bet it would work. But it might not...
-Michel
Thanks Michel, but it seems not to work. The tests I've done show that all depends on the class variable "blockContinuations", if present the __init__ method receives a blocks sequence, if not returns a string with the tag arguments. I've read the source (DT_String and DT_HTML) and it confirms the tests. The parse seems to be done before the call to __init__ based on "blockContinuations". Now I'm almost sure that this is not possible, but perhaps somebody knows a workaround that I haven't noticed. If somebody knows how to do that I'd be very grateful. Thanks, david
participants (2)
-
al028823@alumail.uji.es -
Michel Pelletier