<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<style type="text/css">body{margin-left:10px;margin-right:10px;margin-top:0px;margin-bottom:0px;}</style>
</head>
<body marginleft="10" marginright="10" margintop="0" marginbottom="0">
<font face="Geneva" size="+0" color="#000000" style="font-family:Geneva;font-size:10pt;color:#000000;">Garrett Smith wrote:<br>
<br>
&gt; So we shouldn't see ObjectModifiedEvent being fired directly then. It<br>
&gt; should be one of the two subclasses, correct? This is not the case<br>
&gt; throughout zope/app.<br>
<br>
Jim Fulton answered:<br>
&gt; Yup. Yup.<br>
<br>
A closer look at the ObjectModifiedEvents (or the related modified() calls) <br>
revealed that there are only a few places were these events are actually fired.<br>
Most usages occur inside tests.<br>
<br>
ObjectModifiedEvents are fired in<br>
<br>
1. app.form.browser.add (in a _set_after_add hook together with a list of fields)<br>
2. app.form.browser.editview (after a call of applyWidgetsChanges)<br>
3. app.form.browser.editwizard (after a call of applyWidgetsChanges)<br>
4. app.fssync.committer (after a call of adapter.setBody)<br>
5. zope.app.workflow.stateful.definition (in _publishModified, seems to be<br>
&nbsp;&nbsp;&nbsp;&nbsp;related to container events)<br>
6. zope.app.container.contained (in setitem and uncontained)<br>
<br>
An ObjectAnnotationsModifiedEvent is used in<br>
<br>
7. zope.app.dublincore.browser.metadataedit (for dc.title and dc.description)<br>
<br>
ObjectContentModifiedEvents are currently not used, as already mentioned.<br>
<br>
According to the intrinsic/extrinsic distinction <br>
<br>
1-4 are clear cases for ContentModifiedEvents (or ValueChangedEvents),<br>
5 &amp; 6 indicate modified containers, which are presumably ContentModifiedEvent <br>
according to the intrinsic/extrinsic distinction.<br>
7 is the only clear case for an extrinsic usage.<br>
<br>
Therefore one should use &nbsp;ObjectContentModifiedEvent for 1-6, and <br>
an ObjectAnnotationsModifiedEvent for 7. As far as I see, 4. becomes redundant,<br>
if File._setData fires the event. But the general question is, &nbsp;whether the adapter <br>
or the adapted interface should send the event.<br>
<br>
Alternatively, all mentioned usages could be easily subsumed under an extended<br>
ObjectModifiedEvent definition. Some optional keywords (for the interface and<br>
the attribute that was used to change the object, and additional infos about <br>
the changed values if available) are probably sufficient:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;1-3: ObjectModifiedEvent(obj, interface=schema, attr=field, oldvalue=old, newvalue=new)<br>
&nbsp;&nbsp;&nbsp;&nbsp;4: ObjectModifiedEvent(obj, interface=IObjectFile, attr=&quot;setBody&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;5: ObjectModifiedEvent(obj, interface=IContainer, attr=&quot;__setitem__&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;6: ObjectModifiedEvent(obj, interface=IContainer, attr=&quot;__delitem__&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;7: ObjectModifiedEvent(obj, interface=IZopeDublinCore, attr=&quot;title&quot;)<br>
<br>
Since the keywords are optional, these changes could be easily made in a <br>
backward compatible way.<br>
<br>
Regards,<br>
Uwe<br>
</font>
</body></html>