I think it is a bad decision to use the '-' in special names. Here is my problem: <!--#in outer_list--> <!--#in inner_list--> How to access the sequence-item? this does not work: <!--#var expr="DoSomethingWith(sequence-item)"--> How to acces to the outer_list.sequence-item? This does not work: <!--#var expr="DoSomethingWith(outer_list.sequence-item)"--> neither does this work: <!--#with "_.namespace(inner_item=sequence-item)"/> <!--#var expr="DoSomethingWith(inner_item)"--> <!--#/with--> This indicates, what is going on: <!--#with "_.namespace(sequence=42,item=1)"/--> inserts 41!!! <!--#var expr="sequence-item"--> <!--#/with--> <!--#/in--> <!--#/in--> I think it would be nice, if the <!--#in --> would support an 'as' attribute: <!--#in outer_list as="outer_item"--> <!--#in inner_list as="inner_item"--> <!--#var expr="DoSomethingWith(inner_item)"--> <!--#var expr="DoSomethingWith(outer_item)"--> <!--#/in--> <!--#/in--> Or am I missing something??? Michael -- ''''\ Michael Scharf ` c-@@ TakeFive Software ` > http://www.TakeFive.com \_ V mailto:Michael_Scharf@TakeFive.co.at
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'] <!--#var standard_html_header--> <!--#in "[ [1,2,3], [4,5,6], [7,8,9], ['foo','bar']]"--> <!--#with "_.namespace(outeritem=_['sequence-item'])"--> <!--#in sequence-item--> I am looping over : <!--#var outeritem--> and I've got to <!--#var sequence-item--><BR> <!--#/in--> <!--#/with--> <!--#/in--> <!--#var standard_html_footer--> Cheers, Andy.
-----Original Message----- From: scharf@news.rhein-neckar.de [mailto:scharf@news.rhein-neckar.de]On Behalf Of Michael Scharf Sent: Thursday, December 10, 1998 1:14 PM To: zope.org Subject: [Zope] - Access to sequence-item?
I think it is a bad decision to use the '-' in special names. Here is my problem:
<!--#in outer_list--> <!--#in inner_list--> How to access the sequence-item? this does not work: <!--#var expr="DoSomethingWith(sequence-item)"--> How to acces to the outer_list.sequence-item? This does not work: <!--#var expr="DoSomethingWith(outer_list.sequence-item)"--> neither does this work: <!--#with "_.namespace(inner_item=sequence-item)"/> <!--#var expr="DoSomethingWith(inner_item)"--> <!--#/with--> This indicates, what is going on: <!--#with "_.namespace(sequence=42,item=1)"/--> inserts 41!!! <!--#var expr="sequence-item"--> <!--#/with-->
<!--#/in--> <!--#/in-->
I think it would be nice, if the <!--#in --> would support an 'as' attribute: <!--#in outer_list as="outer_item"--> <!--#in inner_list as="inner_item"--> <!--#var expr="DoSomethingWith(inner_item)"--> <!--#var expr="DoSomethingWith(outer_item)"--> <!--#/in--> <!--#/in-->
Or am I missing something???
Michael -- ''''\ Michael Scharf ` c-@@ TakeFive Software ` > http://www.TakeFive.com \_ V mailto:Michael_Scharf@TakeFive.co.at
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
Michael Scharf wrote:
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
Sorry, a typo:
critique, must good systems start like this). most Michael -- ''''\ Michael Scharf ` c-@@ TakeFive Software ` > http://www.TakeFive.com \_ V mailto:Michael_Scharf@TakeFive.co.at
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, most 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
participants (2)
-
Andy Smith -
Michael Scharf