[Zope3-dev] EditView bug?

Dominik Huber dominik.huber@perse.ch
Thu, 10 Jul 2003 20:10:22 +0200


today i wanted to write an edit-handler deriving from editview.
all the time i got an unexplainable forbiddenattribute error (cp.
attachment).

the error occures because the _setUpWidget() (form/utility.py) uses the
content-object itself as default value instead of the appropriate adapter
for the schema i wanted to use.

to get the correct result the adapter must pass through the
setUpEditWidgets-call.
therefore i suggest following modification in zope/app/browser/form/edit.py,
line 159:


    def update(self):
        ...
            else:
                setUpEditWidgets(self, self.schema,
                                 content=self.adapted, force=1,
                                 names=self.fieldNames)
        ...

        return status

-dominik

stack trace:

ne 164, in update
    names=self.fieldNames)
  File "G:\software\zope3_dev\current\src\zope\app\form\utility.py", line
197, i
n setUpEditWidgets
    names, context, 'display', 'edit')
  File "G:\software\zope3_dev\current\src\zope\app\form\utility.py", line
235, i
n _setUpWidgets
    value = field.get(content)
  File "G:\software\zope3_dev\current\src\zope\schema\_bootstrapfields.py",
line
 132, in get
    return getattr(object, self.__name__)
  File "G:\software\zope3_dev\current\src\zope\security\checker.py", line
225, i
n check_getattr
    self._checker2.check_getattr(object, name)
  File "G:\software\zope3_dev\current\src\zope\security\checker.py", line
138, i
n check_getattr
    self.check(object, name)
  File "G:\software\zope3_dev\current\src\zope\security\checker.py", line
173, i
n check
    raise ForbiddenAttribute, name
ForbiddenAttribute: title