[Zope] sequence-item as a method argument
Rik Hoekstra
rik.hoekstra@inghist.nl
Wed, 14 Jun 2000 22:22:51 +0200
Hello again
I´m still testing the usability and reliability of Zope. To accomplish this
goal I am developing a very very simple shopping cart. But I got troubled by
something aparently simple. This is the code:
<dtml-in "SESSION['cartItems']">
<dtml-in "sqlSearchProduct(productID=sequence-item)">
<tr><td><dtml-var productName></td><td><dtml-var price></td></tr>
</dtml-in>
</dtml-in>
SESSION['cartItems'] is an array created in another DTML document using the
well known SQLSession product. Here I am retrieving the itens of this array
and passing it to a ZSQL method to get the selected items.
The sqlSearchProduct, alone, works well. If I substitute the inner <dtml-in
"sql...> for a simple <dtml-var sequence-item> the block works fine,
otherwise it gives me the following error:
Zope has encountered an error while publishing this resource.
Error Type: NameError
Error Value: sequence
change the line
- <dtml-in "sqlSearchProduct(productID=sequence-item)">
to
+ <dtml-in "sqlSearchProduct(productID=_['sequence-item'])">
in the line as it is now, sequence-item is interpreted as a Python
expression, meaning sequence minus item. The second incantation gets the
variables 'sequence-item' from the current namespace _
hth
Rik