[Zope] Modifying a Dictionaries in an Extenal Method

Dieter Maurer dieter at handshake.de
Sat Jun 4 14:25:44 EDT 2005


Corporate Email Corp. wrote at 2005-6-3 17:30 -0500:
>Does Zope allos an external method to modify a dictionary object that
>is passed to the external method via the REQUEST object.

Zope does not restrict an External Method in any way.

> ...
>items_list = [{'element1':'element1value',
>'element2':'element2value','element3': element3value},{....},....]
>
>I am getting trouble with with this as  any time I try to modify any
>dictionary  from items_list,  items_list[n]   I do get an error
>similar to:
>
> line 120, in agregaItemDicts def agregaItemLista2(self,item,REQUEST):
>File "/usr/local/Zope-2.7.4/lib/python/ZPublisher/HTTPRequest.py",
>line 1502, in __getattr__ raise AttributeError, key AttributeError:
>__setitem__

Usually, this means that the object looks like
a dictionary but is in fact a different object.

However, your traceback is weird:

  It seems to indicate that
  "HTTPRequest.HTTPRequest.__getattr__('__setitem__')
  was called.
  However, "HTTPRequest.HTTPRequest" does have a "__setitem__"
  attribute. Therefore, Python will never call
  "__getattr__" automatically to resolve "__setitem__".

  Something else must have called "__getattr__" inadequately.

  The upper part of traceback (which you dropped) should
  tell you where this calls happens.

-- 
Dieter


More information about the Zope mailing list