[Zope] Adding __setitem__ to a formulator field?

Jeff Kowalczyk jtk@yahoo.com
Wed, 9 Oct 2002 12:47:03 -0400


there are __getitem__() and get_value() methods for formulator fields. I'd like to
experiment with __setitem__ and set_value(). The error message from my naive
implementation in field.py is as follows:

    security.declareProtected('Access contents information', '__setitem__')
    def __setitem__(self, key, value):
        self[key] = value
        self._p_set_changed(1)
        return value

>>> app.Formulator.myForm.stringfield1.__setitem__('required',1)
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
AttributeError: __setitem__
>>>

Does anyone know what I need to do to add __setitem__ (and later on, set_value()) to
formulator fields? Thanks.