Proposal: Include tino's patched <dtml-in> in future Zope
I propose including tino's patched version of the <dtml-in> tag in a future version of Zope. http://www.zope.org/Members/tino/in_tag_patch/ It provides two enhancements: 1. For all variables that include hyphens there are aliases that use underscores. So instead of <dtml-var expr="_['sequence-item'] * 3"> you can write <dtml-var expr="sequence_item * 3"> 2. You can choose the prefix to be used for sequence variables. <dtml-in ... prefix="outer"> <dtml-in ... prefix="inner"> <dtml-var expr="outer_item * inner_item"> </dtml-in> </dtml-in> Hamish Lawson ____________________________________________________________ Do You Yahoo!? Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk or your free @yahoo.ie address at http://mail.yahoo.ie
Hamish Lawson wrote:
I propose including tino's patched version of the <dtml-in> tag in a future version of Zope.
I'll second that :-) Chris
On Tue, 27 Feb 2001 02:30, Hamish Lawson wrote:
I propose including tino's patched version of the <dtml-in> tag in a future version of Zope.
Providing there are no bugs, I wholeheartedy agree with you. Now, I know a lot of people think DTML should be left to die, but personally I think it is not given enough credit. DTML is a wonderful language, and can greatly ease peoples transition from other systems into Zope. Everyone told me 'no, use python to do all your work'. But until Python Methods (and now Python Scripts) it was impractical. My first three Zope applications were entirely in DTML, and the clients have loved every one of them.
It provides two enhancements:
1. For all variables that include hyphens there are aliases that use underscores.
Have been wishing for this for a long time. (o8
So instead of
<dtml-var expr="_['sequence-item'] * 3">
you can write
<dtml-var expr="sequence_item * 3">
2. You can choose the prefix to be used for sequence variables.
Makes a lot of sense to me.
<dtml-in ... prefix="outer"> <dtml-in ... prefix="inner"> <dtml-var expr="outer_item * inner_item"> </dtml-in> </dtml-in>
Hamish Lawson
Have a better one, Curtis Maloney
On Tue, 27 Feb 2001 10:01:18 +1100, Curtis Maloney <curtis@cardgate.net> wrote:
Now, I know a lot of people think DTML should be left to die, but personally I think it is not given enough credit. DTML is a wonderful language, and can greatly ease peoples transition from other systems into Zope.
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. b. If anything in the acquisision context of an element of the inner sequence has an attribute outer_item. c. If an object which is an element of the inner sequence has an attribute inner_item. d. If anything in the acquisision context of an element of the inner sequence has an attribute inner_item. e. If an object which is an element of the outer sequence has an attribute outer_item. f. If anything in the acquisision context of an element of the outer sequence has an attribute outer_item. On Tue, 27 Feb 2001 09:56:17 +1100, Itai Tavor <itai@optusnet.com.au> wrote:
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. dtml is the only language I know which only provides *one* namespace. Toby Dickenson tdickenson@geminidataloggers.com
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
Tino Wildenhain wrote:
<snip argument over namespace> Sorry to jump in here, but can we please not let this argument rob us of yet another chance to get a nice alternative to such abominations as: <dtml-var "_['sequence-item']*3"> <dtml-var "sequence_item 3"> is much nicer :-) Tino, is there any chance you could split your dtml-in patch into two so that the contraversial bit can be argued over while not impeding the most useful bit? please?! Chris
Hi all :-)
Tino Wildenhain wrote:
<snip argument over namespace>
Sorry to jump in here, but can we please not let this argument rob us of yet another chance to get a nice alternative to such abominations as: <dtml-var "_['sequence-item']*3">
<dtml-var "sequence_item 3"> is much nicer :-)
Tino, is there any chance you could split your dtml-in patch into two so that the contraversial bit can be argued over while not impeding the most useful bit?
please?!
Its already. The people who dont like the renaming feature do not simply need to use it :-) E.g. if you omit the prefix-argument, its set to "sequence". Regards Tino
On 26/2/01 3:30 pm, "Hamish Lawson" <hamish_lawson@yahoo.co.uk> wrote:
I propose including tino's patched version of the <dtml-in> tag in a future version of Zope.
So long as it doesn't break anything - it's an excellent idea.
It provides two enhancements:
1. For all variables that include hyphens there are aliases that use underscores.
So instead of
<dtml-var expr="_['sequence-item'] * 3">
you can write
<dtml-var expr="sequence_item * 3">
Gotta agree with that! - *every* time I have to explain about namespaces and the like to someone in our group who just wants to display the number of the row returned from a ZSQL query I silently curse Zope (but very silently, and under my breath, for indeed - it is a *powerful* system and has sharp pointy teef!). Please DC troops - if this *isn't* a dealstopper anywhere, can we have this in 2.3.1? Pretty please? Tone out. -- Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/ The Medical School, Newcastle University Tel: +44 191 243 6140 A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope
participants (6)
-
Chris Withers -
Curtis Maloney -
Hamish Lawson -
Tino Wildenhain -
Toby Dickenson -
Tony McDonald