'list' object is not callable with Zope python script
Sebastian Tänzer <[email protected]>
| Newsgroups | gmane.comp.cms.zms.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello ZMS users,
I'm experiencing a strange problem with a python script used in a ZMS
shop object.
I've got a python script with the id "shop_current" with the following
content:
## Script (Python) "shop_current"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=id=None,vat=True
##title=
##
# --// BO shop_current(id=None,vat=True) //--
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
RESPONSE = request.RESPONSE
session = context.REQUEST.SESSION
quantities=session.get('items', {})
items=[]
for id, quantity in quantities.items():
if ( vat == False ):
item = context.shop_getitems(id=id, vat=False)
else:
item = context.shop_getitems(id=id, vat=True)
if item is not None:
item['quantity']=quantity
items.append(item)
return items
# --// EO shop_current //--
and when I call it from a DTML template with <dtml-let
so="shop_callable(vat=False)"><dtml-in so>....</dtml-in></dtml-let> I
get the error:
Error Type: TypeError
Error Value: 'list' object is not callable
When I don't pass vat and use <dtml-let "shop_callable"> it works but
of course the parameter is not passed to the script.
BUT:
When I create another Script (Python) from inside the ZMI (not ZMS
interface) and put the same code in there it work's fine.
Any idea why this doesn't work with script created from the ZMS
content object configuration?
Mit freundlichen Grüßen
Sebastian Tänzer
[tm] tänzermedien e.K.
Agentur für Online-Medien
Kekuléstr. 39
53115 Bonn
Tel 0228-304134-0
Fax 0228-304134-99
Mobil 0174-333-7001
E-Mail [email protected]
WWW http://www.taenzer.me