[Zope] - Access to sequence-item?

Michael Scharf Michael.Scharf@gmx.de
Thu, 10 Dec 1998 20:07:27 +0100


Andy Smith wrote:

> There may be a nicer way of doing it, but you can access the outerlist by
> using _.namespace to insert the orignal value of sequence-item into the DTML
> namespace as a new variable. In situations where you've got  '-' in your
> name, you can always use _['sequence-item']

I see. I have the feeling, that the expr="..." stuff was
invented later in the design. And therefore those 'dirty
tricks' are necessary:
  <!--#with "_.namespace(outeritem=_['sequence-item'])"--> 
It is very contra-intuitive for me.

This looks absolutely 'grown' to me and not designed (no
critique, must good systems start like this).

I guess this was the sequence of events:
- 'var' and 'in' were the first supported tags
- Good idea: use '-' in special names to make sure there
  is no name clash! Cool!
- Oh! But we need expressions. 'expr=' was added.
- Gash! We need namespace manipulations: OK, lets
  use expr and the special name _ for the namespace itself.
  Hey cool, we can use keyword args:
   expr="_.namespace(name=var,name=1+4)"
- Oh shit! what should we do with the special variables?
  OK let's access them with ['special-name']
  -> <#with "_.namespace(outeritem=_['sequence-item'])"-->

Understandable, but still *very* ugly...

Michael
-- 
     ''''\     Michael Scharf
    ` c-@@     TakeFive Software
    `    >     http://www.TakeFive.com
     \_ V      mailto:Michael_Scharf@TakeFive.co.at