[Zope] Patch to avoid hypenation variables and more

Tino Wildenhain tino@wildenhain.de
Thu, 07 Dec 2000 16:15:03 +0100


Michel Pelletier schrieb:
> 

> > The second problem is if you put one in-tag into another.
> > You have to use <dtml-let> oder REQUEST.set() with variables
> > of the outher in-tag to be able to reference them in the inner
> > loop. The code becomes very ugly this way. So my idea was to
> > give the in-tag an optional argument, called "prefix" to
> > prefix all the sequence-variables with a custom identifier.
> > So you can write:
> >
> > <dtml-in some_sequence prefix="outer_">
> >    <dtml-in some_other_sequence>
> >      <dtml-var outer_sequence_item>:<dtml-var sequence_item>
> >    </dtml-in the inner sequence>
> > </dtml-in the outer sequence>
> >
> > What do you think about this?
> 
> It's cool.  Your patches are big and therefore, naturally, are a bit
> worrisome to us in terms of checking them into the core.  Do you have a
> set of test DTML scripts that verify your patch?  Say, a set of scripts
> that verifies backwards compatibity, and a set of scripts that verifies
> the new functionality?  I would suggest even investigating "ZUnit" and
> creating DTML unit tests.  Then we would *really* love you.  ;)
> 
Have to find this ZUnit... ;)
Ok, I made some further tests and improvements. There was a mistake
(ok, it comes from variables spilled randomly over DT_In.py and
DT_InSV.py ;)
with the prefix. In some cases it wasnt there as supposed.

Now all the prefix-handling should be ok. I've made an yet simple
test-suite, all available thru 
http://www.zope.org/Members/tino/
(See "Patch for <dtml-in>" there)

Note: the prefix prepends only the in-tags own variables. Any attribute
coming from the sequence is untouched. This is also true for statistic
variables and the magic "mapping" symbol.

While it could easy be implemented, I think prefixing all attributes is
not such a good idea. If you are ilterating over database queries you 
can rename the attributes there.


Regards
Tino