[Zope-dev] Basic hassle with manage_changeProperties

Jean Jordaan jean@upfrontsystems.co.za
Wed, 09 Apr 2003 15:21:58 +0200


Hi all

I've encountered a very simple problem with
manage_changeProperties as defined in
Zope-2.6.1-src/lib/python/OFS/PropertyManager.py

The signature is:

     def manage_changeProperties(self, REQUEST=None, **kw):

and the docstring promises:

     Change object properties by passing either a mapping object
     of name:value pairs {'foo':6} or passing name=value parameters

However, if you call something.manage_changeProperties({a:b}),
then REQUEST will be {a:b} and the final check in
manage_changeProperties will be true, and manage_propertiesForm
will be returned:

     if REQUEST:
         message="Saved changes."
         return self.manage_propertiesForm(self,REQUEST,
                                   manage_tabs_message=message)

Now, manage_propertiesForm expects REQUEST to be a proper REQUEST
object and fails with a KeyError on URL1, when it is a simple
dictionary.

manage_changeProperties as defined in
Zope-2.6.1-src/lib/python/OFS/PropertySheets.py
doesn't suffer this problem, since it returns MessageDialog,
which doesn't expect anything beyond the keyword parameters it's
passed.

Either Zope-2.6.1-src/lib/python/OFS/PropertyManager.py should
be taught to distinguish between {a:b} and REQUEST, or the
docstring should be changed to:

     Change object properties by passing either the REQUEST,
     or passing name=value parameters

Should I file an issue for this?

Regards,
-- 
Jean Jordaan
http://www.upfrontsystems.co.za