[Zope-dev] z3c.form: GroupForm and ModificationEvents

Martin Aspeli optilude+lists at gmail.com
Wed Jan 13 00:08:49 EST 2010


Michael Howitz wrote:
> Hi,
>
> it seems to me that z3c.form.group.GroupForm does not send enough
> ModificationEvents: only one event for the context of the GroupForm
> but not for each modified object in the groups.

-1 to this being default behaviour.

IObjectModifiedEvent is fired from EditForms, not from forms in general. 
Normally, an EditForm is used to edit "a context". The groups could come 
from various locations (we use groups to create fieldsets based on 
schema hints, but they're all logically part of the same content 
object). I would not expect more than one event sent (in fact, doing 
this would significantly break code in the wild).

> In a project of mine I have the following situation: I have a folder
> with some contained objects. A GroupForm displays the schema fields
> of the folder and the ones of all contained objects. When I modify
> one of the fields of a contained object I would expect a
> ModifiedEvent for this object. (Is this a valid expectation?) But
> GroupForm sends only one ModifiedEvent for the Folder (context of the
> form). This is even wrong in my case. At least the
> ModifiedEvent-Subscriber in zope.dublincore can't handle this and
> wrongly marks only the folder as modified.
>
> Do I have a very special use case which should be handled inside my
> project? Or should I change GroupForm to send a ModifiedEvent for
> each modified object?

I think you should override the action handler and do this for your 
project. I don't think it should be the default behaviour.

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the Zope-Dev mailing list