[Zope3-checkins] CVS: Zope3/src/zope/app/cache - annotationcacheable.py:1.7 caching.py:1.9 configure.zcml:1.8

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Mar 10 14:41:34 EST 2004


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

Modified Files:
	annotationcacheable.py caching.py configure.zcml 
Log Message:


Removed the caching service. It was not providing much value anyways, so it was
easy.



Also, I updated the views in a way that SQL Script's chace support would work
again.



There is still much to do:



- zope.app.cache.caching does not have a formally defined API (interface)



- The CacheName field should be a vocabulary field.



- Views need to be updated to current form.


=== Zope3/src/zope/app/cache/annotationcacheable.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/cache/annotationcacheable.py:1.6	Sat Mar  6 11:50:16 2004
+++ Zope3/src/zope/app/cache/annotationcacheable.py	Wed Mar 10 14:41:00 2004
@@ -19,8 +19,7 @@
 
 from zope.app import zapi
 from zope.app.interfaces.annotation import IAnnotations
-from zope.app.cache.interfaces import ICacheable
-from zope.app.services.servicenames import Caching
+from zope.app.cache.interfaces import ICacheable, ICache
 
 annotation_key = 'zope.app.cache.CacheManager'
 
@@ -40,8 +39,7 @@
         # Remove object from old cache
         old_cache_id = self.getCacheId()
         if old_cache_id and old_cache_id != id:
-            service = zapi.getService(self._context, Caching)
-            cache = service.getCache(old_cache_id)
+            cache = zapi.getUtility(self._context, ICache, old_cache_id)
             cache.invalidate(self._context)
         annotations = IAnnotations(self._context)
         annotations[annotation_key] = id


=== Zope3/src/zope/app/cache/caching.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/cache/caching.py:1.8	Sat Mar  6 11:50:16 2004
+++ Zope3/src/zope/app/cache/caching.py	Wed Mar 10 14:41:00 2004
@@ -16,18 +16,16 @@
 $Id$
 """
 from zope.app import zapi
-from zope.app.cache.interfaces import ICacheable
-from zope.app.services.servicenames import Caching
+from zope.app.cache.interfaces import ICacheable, ICache
 from zope.component import ComponentLookupError
 
-def getCacheForObj(obj):
+def getCacheForObject(obj):
     """Returns the cache associated with obj or None."""
     adapter = ICacheable(obj)
     cache_id = adapter.getCacheId()
     if not cache_id:
         return None
-    service = zapi.getService(obj, Caching)
-    return service.getCache(cache_id)
+    return zapi.getUtility(obj, ICache, cache_id)
 
 def getLocationForCache(obj):
     """Returns the location to be used for caching the object or None."""


=== Zope3/src/zope/app/cache/configure.zcml 1.7 => 1.8 ===
--- Zope3/src/zope/app/cache/configure.zcml:1.7	Tue Mar  9 07:38:46 2004
+++ Zope3/src/zope/app/cache/configure.zcml	Wed Mar 10 14:41:00 2004
@@ -1,10 +1,5 @@
 <configure xmlns="http://namespaces.zope.org/zope">
 
-  <serviceType 
-      id="Caching"
-      interface="zope.app.cache.interfaces.ICachingService"
-      />
-
   <adapter 
       for="zope.app.interfaces.annotation.IAnnotatable"
       provides="zope.app.cache.interfaces.ICacheable"




More information about the Zope3-Checkins mailing list