[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container/Find/Views/Browser - Find.py:1.1.2.4.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/Find/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv12181/lib/python/Zope/App/OFS/Container/Find/Views/Browser

Modified Files:
      Tag: Zope3InWonderland-branch
	Find.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/Find/Views/Browser/Find.py 1.1.2.4 => 1.1.2.4.4.1 ===
 """
 
-from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
 from Zope.App.PageTemplate import ViewPageTemplateFile
 from Zope.App.OFS.Container.Find.IFind import IFind
 # XXX this needs to be looked up in a registry
 from Zope.App.OFS.Container.Find.FindAdapter import SimpleIdFindFilter
 
-from Zope.ComponentArchitecture import getAdapter, getRequestView
+from Zope.ComponentArchitecture import getAdapter, getView
 
-# XXX very simple implementation right now
-class Find(AttributePublisher):
-
-    def __init__(self, context):
-        self._context = context
+from Zope.Publisher.Browser.BrowserView import BrowserView
 
-    def getContext(self):
-        return self._context
+# XXX very simple implementation right now
+class Find(BrowserView):
     
     index = ViewPageTemplateFile('find.pt')
-
-    def setViewRequest(self, request):
-        self._request = request
         
     def findByIds(self, ids):
         """Do a find for the ids listed in ids, which is a string.
         """
-        finder = getAdapter(self._context, IFind)
+        finder = getAdapter(self.context, IFind)
         ids = ids.split()
         # if we don't have any ids listed, don't search at all
         if not ids:
             return []
-        request = self._request
+        request = self.request
         result = []
         for object in finder.find([SimpleIdFindFilter(ids)]):
             id = getId(object)
-            url = str(getRequestView(object, 'absolute_url', request))
+            url = str(getView(object, 'absolute_url', request))
             result.append({ 'id': id, 'url': url})
         return result