[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container/Views/Browser - Adder.py:1.1.2.7.4.1 Contents.py:1.1.2.5.4.1

Jim Fulton jim@zope.com
Wed, 29 May 2002 11:10:09 -0400


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

Modified Files:
      Tag: Zope3InWonderland-branch
	Adder.py Contents.py 
Log Message:
- Added permission_id attribute to adapter and utility directives.

- Got rid of old getView, getResource, and getDefaultViewName.
  Renamed getRequestView to getView (and so on).

  Changed view interface to use context, rather than getContext.

  Introduced notion of presentation types (e.g. IBrowserPresentation, 
  which is cleaner than IBrowserPublisher).

- Began converting to get/queryFoo, which is much nicer.

- Many formatting fixups.



=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Adder.py 1.1.2.7 => 1.1.2.7.4.1 ===
 """
 
-from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
+from Zope.Publisher.Browser.BrowserView import BrowserView
 from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
 from Zope.App.PageTemplate import ViewPageTemplateFile
 from Zope.ComponentArchitecture import createObject
 from Zope.App.OFS.Services.AddableService import getAddableContent
-from Zope.ComponentArchitecture.ContextDependent import ContextDependent
 from Zope.App.OFS.Container.Exceptions import DuplicateIDError
 from Zope.Proxy.ProxyIntrospection import removeAllProxies
 
-class ContainerAdder(AttributePublisher, ContextDependent):
+class ContainerAdder(BrowserView):
 
     def _listAddables( self ):
         """
             Derived classes override this to change the registry
             in which factories are looked up.
         """
-        return getAddableContent(self.getContext())
+        return getAddableContent(self.context)
 
     def listAddableInfo( self ):
         """
@@ -45,7 +44,7 @@
         """
             Instantiate an object and put it in our folder.
         """
-        context = self.getContext()
+        context = self.context
         
         if id in context.objectIds():
             raise DuplicateIDError, "ID '%s' already in use." % id


=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Contents.py 1.1.2.5 => 1.1.2.5.4.1 ===
 import os
 
-from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
-from Zope.ComponentArchitecture.ContextDependent import ContextDependent
+from Zope.Publisher.Browser.BrowserView import BrowserView
 from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
 from Zope.App.PageTemplate import ViewPageTemplateFile
 from Zope.App.OFS.Container.IContainer import IContainer
 
-class Contents(ContextDependent, AttributePublisher):
+class Contents(BrowserView):
 
-    __implements__ = AttributePublisher.__implements__
     __used_for__ = IContainer
 
     def _extractContentInfo( self, item ):
@@ -62,14 +60,14 @@
             exception).
         """
         try:
-            self.getContext().delObject( name )
+            self.context.delObject( name )
         except KeyError:
             if not silent:
                 raise
         return self.confirmRemoved( name=name )
 
     def listContentInfo(self):
-        return map(self._extractContentInfo, self.getContext().objectItems())
+        return map(self._extractContentInfo, self.context.objectItems())
 
     index = ViewPageTemplateFile('main.pt')
     confirmRemoved = ViewPageTemplateFile('remove_confirmed.pt')