[Zope3-checkins] CVS: Zope3/src/zope/app/cache -
annotationcacheable.py:1.4.6.1 caching.py:1.5.6.1
Jim Fulton
jim at zope.com
Mon Sep 8 15:22:03 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/cache
In directory cvs.zope.org:/tmp/cvs-serv20092/src/zope/app/cache
Modified Files:
Tag: parentgeddon-branch
annotationcacheable.py caching.py
Log Message:
Checking in work in progress on parentgeddon-branch so Fred can help
me to get the tests passing. Specific log entries will be provided
when we merge this into the head.
=== Zope3/src/zope/app/cache/annotationcacheable.py 1.4 => 1.4.6.1 ===
--- Zope3/src/zope/app/cache/annotationcacheable.py:1.4 Tue Aug 19 13:34:08 2003
+++ Zope3/src/zope/app/cache/annotationcacheable.py Mon Sep 8 14:21:32 2003
@@ -17,7 +17,7 @@
"""
from zope.app import zapi
from zope.app.interfaces.annotation import IAnnotations
-from zope.app.interfaces.cache import ICacheable
+from zope.app.interfaces.cache import ICacheable, ICache
from zope.app.services.servicenames import Caching
from zope.interface import implements
@@ -39,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 = getUtility(self._context, ICache, old_cache_id)
cache.invalidate(self._context)
annotations = zapi.getAdapter(self._context, IAnnotations)
annotations[annotation_key] = id
=== Zope3/src/zope/app/cache/caching.py 1.5 => 1.5.6.1 ===
--- Zope3/src/zope/app/cache/caching.py:1.5 Tue Aug 19 13:34:08 2003
+++ Zope3/src/zope/app/cache/caching.py Mon Sep 8 14:21:32 2003
@@ -13,23 +13,21 @@
##############################################################################
"""Helpers for caching."""
-from zope.component import getAdapter, getService, ComponentLookupError
-from zope.app.interfaces.cache import ICacheable
-from zope.app.traversing import getPath
-
+from zope.app import zapi
+from zope.component import ComponentLookupError
+from zope.app.interfaces.cache import ICacheable, ICache
def getCacheForObj(obj):
"""Returns the cache associated with obj or None."""
- adapter = getAdapter(obj, ICacheable)
+ adapter = zapi.getAdapter(obj, ICacheable)
cache_id = adapter.getCacheId()
if not cache_id:
return None
- service = 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."""
try:
- return getPath(obj)
+ return zapi.getPath(obj)
except (ComponentLookupError, TypeError):
return None
More information about the Zope3-Checkins
mailing list