[Checkins] SVN: z3ext.layoutform/trunk/ Added changed attributes descriptions to ObjectModifiedEvent for subform

Nikolay Kim fafhrd at datacom.kz
Fri Apr 3 05:45:34 EDT 2009


Log message for revision 98825:
  Added changed attributes descriptions to ObjectModifiedEvent for subform

Changed:
  U   z3ext.layoutform/trunk/CHANGES.txt
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/subform.py
  U   z3ext.layoutform/trunk/src/z3ext/layoutform/utils.py

-=-
Modified: z3ext.layoutform/trunk/CHANGES.txt
===================================================================
--- z3ext.layoutform/trunk/CHANGES.txt	2009-04-03 09:40:32 UTC (rev 98824)
+++ z3ext.layoutform/trunk/CHANGES.txt	2009-04-03 09:45:33 UTC (rev 98825)
@@ -2,6 +2,13 @@
 CHANGES
 =======
 
+
+1.3.4 (2009-04-03)
+------------------
+
+- Added changed attributes descriptions to ObjectModifiedEvent for subform
+
+
 1.3.3 (2009-03-11)
 ------------------
 

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/subform.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/subform.py	2009-04-03 09:40:32 UTC (rev 98824)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/subform.py	2009-04-03 09:45:33 UTC (rev 98825)
@@ -18,7 +18,7 @@
 from zope import interface, event
 from zope.component import queryMultiAdapter
 from zope.traversing.browser import absoluteURL
-from zope.lifecycleevent import ObjectModifiedEvent
+from zope.lifecycleevent import Attributes, ObjectModifiedEvent
 
 from z3c.form import subform, button
 from z3c.form.interfaces import ISubForm, IActionHandler
@@ -51,9 +51,14 @@
             IStatusMessage(self.request).add(
                 (self.formErrorsMessage,) + errors, 'formError')
         else:
-            if self.applyChanges(data):
-                event.notify(ObjectModifiedEvent(self.getContent()))
+            changes = self.applyChanges(data)
+            if changes:
+                descriptions = []
+                for interface, names in changes.items():
+                    descriptions.append(Attributes(interface, *names))
 
+                event.notify(ObjectModifiedEvent(self.getContent(), *descriptions))
+
     def executeActions(self, form):
         request = self.request
         content = self.getContent()

Modified: z3ext.layoutform/trunk/src/z3ext/layoutform/utils.py
===================================================================
--- z3ext.layoutform/trunk/src/z3ext/layoutform/utils.py	2009-04-03 09:40:32 UTC (rev 98824)
+++ z3ext.layoutform/trunk/src/z3ext/layoutform/utils.py	2009-04-03 09:45:33 UTC (rev 98825)
@@ -28,6 +28,7 @@
 
         # Get the datamanager and get the original value
         dm = getMultiAdapter((content, field.field), IDataManager)
+
         # Only update the data, if it is different
         try:
             value = dm.get()



More information about the Checkins mailing list