[Zope] Proposal: Include tino's patched <dtml-in> in future
Zope
Tino Wildenhain
tino@wildenhain.de
Tue, 27 Feb 2001 10:48:07 +0100
Hi Toby, others,
...
> dtml is good enough for document templates, however there are serious
> quality issues for anything involving logic.
>
> Lets analyse this
>
>>> <dtml-in ... prefix="outer">
>>> <dtml-in ... prefix="inner">
>>> <dtml-var expr="outer_item * inner_item">
>>> </dtml-in>
>>> </dtml-in>
>
> By the time it gets to evaluating the dtml-var, the namespace stack
> contains:
> 1. an element from the inner sequence
> 2. inner_stuff
> 3. an element from the outer sequence
> 4. outer_stuff
> 5. the namespace provided by the caller
>
> The dtml-var is looking up two names in the namespace. We know it
> expects to find the values that were provided by the dtml-in tags,
> however it is possible for something higher up the namespace stack to
> provide a different value under the same name, breaking your dtml-var
> expression.
>
> Where can it go wrong?
>
> a. If an object which is an element of the inner sequence has an
> attribute outer_item.
sure. The responsible programmer then has to use another prefix. Obviously.
> b. If anything in the acquisision context of an element of the inner
> sequence has an attribute outer_item.
the same like a but only if the programmer wants to use the other element
instead
of the sequences.
>
> c. If an object which is an element of the inner sequence has an
> attribute inner_item.
like a) the programmer wants to choose just another prefix. Or none in which
case it is "sequence"
> d. If anything in the acquisision context of an element of the inner
> sequence has an attribute inner_item.
See above :-)
> e. If an object which is an element of the outer sequence has an
> attribute outer_item.
Again and again...
> f. If anything in the acquisision context of an element of the outer
> sequence has an attribute outer_item.
and so on... :-)
>> citing some irrelevant concern about polluting the namespace.
>
> namespace pollution is less serious if you have a greater number of
> namespaces, and more serious if you have fewer.
Cant see the point here. Since the namespace is already polluted by
the in-tag. If you put one in-tag into another its still polluted.
Including all the issues with namespace containing zope objects, request
variables and stuff from the sequence.
I encurrage programmers to choose well selected names for their objects and
variables. I myself like to use arg_name variables for arguments and so on.
HTH
Tino Wildenhain