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

Guido van Rossum guido@python.org
Wed, 4 Dec 2002 09:43:05 -0500


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

Modified Files:
	index.py 
Log Message:
Minor refactoring.


=== Zope3/lib/python/Zope/App/index/text/index.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/App/index/text/index.py:1.2	Wed Dec  4 09:22:58 2002
+++ Zope3/lib/python/Zope/App/index/text/index.py	Wed Dec  4 09:43:04 2002
@@ -61,9 +61,8 @@
         return adapted.getSearchableText()
     _getTexts = ContextMethod(_getTexts)
 
-    def subscribe(wrapped_self, channel=None, update=1):
-        if channel is None:
-            channel = wrapped_self._getChannel()
+    def subscribe(wrapped_self, channel=None, update=True):
+        channel = wrapped_self._getChannel(channel)
         channel.subscribe(wrapped_self, IRegistrationHubEvent)
         channel.subscribe(wrapped_self, IObjectModifiedHubEvent)
         if update:
@@ -71,14 +70,15 @@
     subscribe = ContextMethod(subscribe)
 
     def unsubscribe(wrapped_self, channel=None):
-        if channel is None:
-            channel = wrapped_self._getChannel()
+        channel = wrapped_self._getChannel(channel)
         channel.unsubscribe(wrapped_self, IObjectModifiedHubEvent)
         channel.unsubscribe(wrapped_self, IRegistrationHubEvent)
     unsubscribe = ContextMethod(unsubscribe)
 
-    def _getChannel(wrapped_self):
-        return getService(wrapped_self, "ObjectHubService")
+    def _getChannel(wrapped_self, channel):
+        if channel is None:
+            channel = getService(wrapped_self, "ObjectHubService")
+        return channel
     _getChannel = ContextMethod(_getChannel)
 
     def _update(wrapped_self, registrations):