Re: [Zope] sequence-item as a method argument

2000-06-14 Thread Rik Hoekstra




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)"
   trtddtml-var productName/tdtddtml-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


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] sequence-item as a method argument

2000-06-14 Thread Thomas Weiner

Fabio Akita schrieb:
 
[ sequence-item in a python expression ]
 
 Error Type: NameError
 Error Value: sequence
 
 Anyone knows what is going on? I think this must be a simple thing.

Everything in quotes is taken as a python expression, therefore Zope
wants to evaluate "sequence - item"; this won't work because sequence
and item aren't defined.

Try:

dtml-in "sqlSearchProduct(productID=_['sequence-item'])"

_ is the current namespace, where Zope will find the value of
sequence-item.

hth
Thomas

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )