Re: [Zope-dev] z3c.form: GroupForm and ModificationEvents
Am 13.01.2010 um 06:08 schrieb Martin Aspeli: 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. GroupForm has an applyChanges method which send this event. The Group class collects some data for it in its applyChanges method. 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). The refactoring needn't break the code in the wild by sending only one ModifiedEvent for each different context object being changed. When a group has the same context as the group form, I agree, there should not be two events. 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. I can do so. But am I the only one who edits more than one object in a GroupForm and might need this feature? Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] z3c.form: GroupForm and ModificationEvents
Am 12.01.2010 um 22:22 schrieb Roger: Hi Michael Betreff: [Zope-dev] z3c.form: GroupForm and ModificationEvents [...] 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'm not using group forms so I can't say if it's wrong or right. But I have a question. Does the ISublocation adapter not dispatch the modified event to the containers items? I think ISublocation does not help me here, as the folder is not changed only one item in it. The event wrongly (at least to me) tells the folder as modified. Are you sure that you use the ISublocation adapter which will dispatch events to container items? If this will not help, I think it's not bad to implement such an event notification. Probably in a method or with a marker which allows others to simply disable the additional event notification. Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] z3c.form: GroupForm and ModificationEvents
Michael Howitz wrote: Am 13.01.2010 um 06:08 schrieb Martin Aspeli: 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. GroupForm has an applyChanges method which send this event. The Group class collects some data for it in its applyChanges method. Sure, but IIRC GroupForm is only really intended as a mixin. In any case, we shouldn't by default send IObjectModifiedEvents from something that isn't an edit form. Not all (group) forms are edit forms. And even for the EditForm scenario, most edit forms edit exactly one context. Your use case is very particular to your application. The refactoring needn't break the code in the wild by sending only one ModifiedEvent for each different context object being changed. When a group has the same context as the group form, I agree, there should not be two events. That would still break code. 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. I can do so. But am I the only one who edits more than one object in a GroupForm and might need this feature? Perhaps. :) I don't think you can generalise this anyway. Martin -- Author of `Professional Plone Development`, a book for developers who want to work with Plone. See http://martinaspeli.net/plone-book ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] z3c.form: GroupForm and ModificationEvents
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. 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? Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] z3c.form: GroupForm and ModificationEvents
Hi Michael Betreff: [Zope-dev] z3c.form: GroupForm and ModificationEvents 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. 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'm not using group forms so I can't say if it's wrong or right. But I have a question. Does the ISublocation adapter not dispatch the modified event to the containers items? Are you sure that you use the ISublocation adapter which will dispatch events to container items? If this will not help, I think it's not bad to implement such an event notification. Probably in a method or with a marker which allows others to simply disable the additional event notification. Regards Roger Ineichen Yours sincerely, -- Michael Howitz · m...@gocept.com · software developer gocept gmbh co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1 Zope and Plone consulting and development ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] z3c.form: GroupForm and ModificationEvents
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 ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )