[Zope3-checkins] CVS: Zope3/src/zope/app/cache/interfaces - __init__.py:1.2

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Mar 2 09:25:01 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/cache/interfaces
In directory cvs.zope.org:/tmp/cvs-serv21657/src/zope/app/cache/interfaces

Modified Files:
	__init__.py 
Log Message:


I originally added queryService() to ZAPI and this should have never been
done. Remove it and use getService() in the places where it was used instead.




=== Zope3/src/zope/app/cache/interfaces/__init__.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/cache/interfaces/__init__.py:1.1	Mon Mar  1 05:57:36 2004
+++ Zope3/src/zope/app/cache/interfaces/__init__.py	Tue Mar  2 09:24:30 2004
@@ -15,11 +15,13 @@
 
 $Id$
 """
+from zope.component.exceptions import ComponentLookupError  
+from zope.interface import Interface
+from zope.schema import TextLine
+
 from zope.app import zapi
 from zope.app.interfaces.event import ISubscriber
 from zope.app.services.servicenames import Caching
-from zope.interface import Interface
-from zope.schema import TextLine
 
 class CacheName(TextLine):
     """Cache Name"""
@@ -27,8 +29,9 @@
     def __allowed(self):
         """Note that this method works only if the Field is context wrapped.
         """
-        service = zapi.queryService(self.context, Caching)
-        if service is None:
+        try:
+            service = zapi.getService(self.context, Caching)
+        except ComponentLookupError, err:
             return ['']
         else:
             return [''] + list(service.getAvailableCaches())




More information about the Zope3-Checkins mailing list