[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container/Views/Browser - Adding.py:1.8
Jim Fulton
jim@zope.com
Fri, 4 Oct 2002 15:48:31 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Container/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv4279/lib/python/Zope/App/OFS/Container/Views/Browser
Modified Files:
Adding.py
Log Message:
Added logic to generate object events when objects are modified,
created, or added.
=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adding.py 1.7 => 1.8 ===
--- Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adding.py:1.7 Wed Oct 2 17:35:47 2002
+++ Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adding.py Fri Oct 4 15:48:30 2002
@@ -25,6 +25,9 @@
from Zope.App.PageTemplate import ViewPageTemplateFile
from Zope.ContextWrapper import ContextMethod, getbaseobject
from Zope.Proxy.ContextWrapper import ContextWrapper
+from Zope.Event import publishEvent
+from Zope.Event.ObjectEvent \
+ import ObjectCreatedEvent, ObjectModifiedEvent, ObjectAddedEvent
class Adding(BrowserView):
@@ -40,7 +43,10 @@
'See Zope.App.OFS.Container.IAdding.IAdding'
content = removeAllProxies(content) # XXX We need to think about this
name = self.context.setObject(self.contentName, content)
- return ContextWrapper(self.context[name], self.context, name=name)
+ content = ContextWrapper(self.context[name], self.context, name=name)
+ publishEvent(self.context, ObjectAddedEvent(content))
+ publishEvent(self.context, ObjectModifiedEvent(self.context))
+ return content
# See Zope.App.OFS.Container.Views.Browser.IAdding.IAdding
contentName=None # usually set by Adding traverser
@@ -109,6 +115,8 @@
self.contentName = id
content = createObject(self, type_name)
+ publishEvent(self.context, ObjectCreatedEvent(content))
+
self.add(content)
self.request.response.redirect(self.nextURL())