[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container/Views/Browser - Adding.py:1.7

Jeremy Hylton jeremy@zope.com
Wed, 2 Oct 2002 17:35:47 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Container/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv25863/lib/python/Zope/App/OFS/Container/Views/Browser

Modified Files:
	Adding.py 
Log Message:
Extend defintion of add() of IAdding interface.

add() should return the added object in the context of the container.




=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adding.py 1.6 => 1.7 ===
--- Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adding.py:1.6	Tue Oct  1 08:49:07 2002
+++ Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adding.py	Wed Oct  2 17:35:47 2002
@@ -24,6 +24,7 @@
      import getView, getService, createObject, queryFactory, queryView
 from Zope.App.PageTemplate import ViewPageTemplateFile
 from Zope.ContextWrapper import ContextMethod, getbaseobject
+from Zope.Proxy.ContextWrapper import ContextWrapper
 
 class Adding(BrowserView):
 
@@ -38,7 +39,8 @@
     def add(self, content):
         'See Zope.App.OFS.Container.IAdding.IAdding'
         content = removeAllProxies(content) # XXX We need to think about this
-        return self.context.setObject(self.contentName, content)
+        name = self.context.setObject(self.contentName, content)
+        return ContextWrapper(self.context[name], self.context, name=name)
     
     # See Zope.App.OFS.Container.Views.Browser.IAdding.IAdding
     contentName=None # usually set by Adding traverser