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

Steve Alexander steve@cat-box.net
Tue, 17 Dec 2002 14:13:33 -0500


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

Modified Files:
	Adding.py 
Log Message:
Changed a super to a ContextSuper.
Removed extraneous imports.
Made a method a context method.
All in the aid of http://collector.zope.org/Zope3-dev/84



=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adding.py 1.15 => 1.16 ===
--- Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adding.py:1.15	Wed Dec  4 11:59:49 2002
+++ Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adding.py	Tue Dec 17 14:13:32 2002
@@ -24,12 +24,12 @@
      import getView, getService, createObject, \
             queryFactory, queryView, getAdapter
 from Zope.App.PageTemplate import ViewPageTemplateFile
-from Zope.ContextWrapper import ContextMethod, getbaseobject
-from Zope.Proxy.ContextWrapper import ContextWrapper
+from Zope.ContextWrapper import ContextMethod 
 from Zope.Event import publish
-from Zope.Event.ObjectEvent \
-     import ObjectCreatedEvent, ObjectModifiedEvent, ObjectAddedEvent
+from Zope.Event.ObjectEvent import ObjectCreatedEvent
 from Zope.App.OFS.Container.IZopeContainer import IZopeContainer
+from Zope.ContextWrapper import ContextSuper
+
 class Adding(BrowserView):
 
     __implements__ =  IAdding, IPublishTraverse
@@ -42,11 +42,9 @@
 
     def add(self, content):
         'See Zope.App.OFS.Container.IAdding.IAdding'
-        container = self.context
-        container = getAdapter(container, IZopeContainer)
+        container = getAdapter(self.context, IZopeContainer)
         name = container.setObject(self.contentName, content)
         return container[name]
-
     
     # See Zope.App.OFS.Container.Views.Browser.IAdding.IAdding
     contentName = None # usually set by Adding traverser
@@ -84,11 +82,9 @@
 
         factory = queryFactory(self.context, name)
         if factory is None:
-            return super(Adding, getbaseobject(self)
-                         ).publishTraverse(request, name)
+            return ContextSuper(Adding, self).publishTraverse(request, name)
 
         return factory
-
     publishTraverse = ContextMethod(publishTraverse)
     
     #
@@ -96,11 +92,13 @@
 
     index = ViewPageTemplateFile("add.pt")
 
-    def addingInfo(self):
+    def addingInfo(wrapped_self):
         """Return menu data"""
-
-        menu_service = getService(self.context, "BrowserMenu")
-        return menu_service.getMenu(self.menu_id, self, self.request)
+        menu_service = getService(wrapped_self.context, "BrowserMenu")
+        return menu_service.getMenu(wrapped_self.menu_id,
+                                    wrapped_self,
+                                    wrapped_self.request)
+    addingInfo = ContextMethod(addingInfo)
 
     def action(self, type_name, id=''):
         if queryView(self, type_name, self.request) is not None: