[Zope3-checkins] CVS: Zope3/src/zope/app/cache - caching.py:1.6
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Sep 16 17:59:18 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/cache
In directory cvs.zope.org:/tmp/cvs-serv11969/src/zope/app/cache
Modified Files:
caching.py
Log Message:
Insert CVS id and convert to use zapi
=== Zope3/src/zope/app/cache/caching.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/cache/caching.py:1.5 Tue Aug 19 13:34:08 2003
+++ Zope3/src/zope/app/cache/caching.py Tue Sep 16 17:59:17 2003
@@ -11,25 +11,27 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Helpers for caching."""
+"""Helpers for caching.
-from zope.component import getAdapter, getService, ComponentLookupError
+$Id$
+"""
+from zope.app import zapi
from zope.app.interfaces.cache import ICacheable
-from zope.app.traversing import getPath
-
+from zope.app.services.servicenames import Caching
+from zope.component import ComponentLookupError
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")
+ service = zapi.getService(obj, Caching)
return service.getCache(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