[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/index/text - control.py:1.2

Guido van Rossum guido@python.org
Thu, 12 Dec 2002 12:25:16 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/index/text
In directory cvs.zope.org:/tmp/cvs-serv8818

Modified Files:
	control.py 
Log Message:
Inherit from BrowserView.  Use self.context instead of self.index.


=== Zope3/lib/python/Zope/App/index/text/control.py 1.1 => 1.2 ===
--- Zope3/lib/python/Zope/App/index/text/control.py:1.1	Mon Dec  9 14:47:16 2002
+++ Zope3/lib/python/Zope/App/index/text/control.py	Thu Dec 12 12:25:15 2002
@@ -23,21 +23,21 @@
 from Zope.ComponentArchitecture import getService, queryAdapter
 from Zope.Exceptions import NotFoundError
 from Zope.Publisher.Browser.IBrowserView import IBrowserView
+from Zope.Publisher.Browser.BrowserView import BrowserView
 
 from Zope.App.Traversing import locationAsUnicode
 from Zope.App.DublinCore.IZopeDublinCore import IZopeDublinCore
 from Zope.App.index.text.interfaces import IQueryView
 
-class ControlView(object):
+class ControlView(BrowserView):
 
-    __implements__ = IBrowserView, IQueryView
+    __implements__ = BrowserView.__implements__, IQueryView
 
     default_start = 0 # Don't change -- always start at first batch
     default_count = 2 # Default batch size -- tune as you please
 
     def __init__(self, context, request):
-        self.index = self.context = context
-        self.request = request
+        super(ControlView, self).__init__(context, request)
         self.hub = getService(context, "ObjectHub")
 
     def nextBatch(self):
@@ -55,7 +55,7 @@
         if start is None:
             start = int(self.request.get('start', self.default_start))
         count = int(self.request.get('count', self.default_count))
-        results, total = self.index.query(queryText, start, count)
+        results, total = self.context.query(queryText, start, count)
         nresults = len(results)
         first = start + 1
         last = first + len(results) - 1
@@ -91,7 +91,7 @@
         except NotFoundError:
             pass
         else:
-            dc = queryAdapter(object, IZopeDublinCore, context=self.index)
+            dc = queryAdapter(object, IZopeDublinCore, context=self.context)
             if dc is not None:
                 title = dc.title
                 result['title'] = title