[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - editwizard.py:1.6
Stuart Bishop
zen@shangri-la.dropbear.id.au
Tue, 15 Jul 2003 10:09:31 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv25654
Modified Files:
editwizard.py
Log Message:
Send ObjectModifiedEvents when changed
=== Zope3/src/zope/app/browser/form/editwizard.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/form/editwizard.py:1.5 Mon Jul 14 11:28:23 2003
+++ Zope3/src/zope/app/browser/form/editwizard.py Tue Jul 15 10:09:27 2003
@@ -37,6 +37,8 @@
from submit import Next, Previous, Update
from zope.app.interfaces.form import WidgetsError
from zope.i18n import MessageIDFactory
+from zope.app.event import publish
+from zope.app.event.objectevent import ObjectModifiedEvent
PaneNumber = 'CURRENT_PANE_IDX'
@@ -176,10 +178,16 @@
''' Save changes to our content object '''
for k,v in storage.items():
getattr(self,k).setData(v)
- return not applyWidgetsChanges(
- self, self.adapted, self.schema,
+ content = self.adapted
+ changed = applyWidgetsChanges(
+ self, content, self.schema,
names=self.fieldNames, exclude_readonly=True
)
+ # We should not generate events when an adapter is used.
+ # That's the adapter's job
+ if changed and self.context is self.adapted:
+ publish(content, ObjectModifiedEvent(content))
+ return not changed
def renderHidden(self):
''' Render state as hidden fields. Also render hidden fields to