[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/cache/caching.py Add a default parameter so that it doesn't fail badly when there's no

Sidnei da Silva sidnei at awkly.org
Tue Jul 6 15:43:35 EDT 2004


Log message for revision 26135:

Add a default parameter so that it doesn't fail badly when there's no
adapter available. It should just return None, so that code using this
will fallback to not using cache.




-=-
Modified: Zope3/trunk/src/zope/app/cache/caching.py
===================================================================
--- Zope3/trunk/src/zope/app/cache/caching.py	2004-07-06 19:41:54 UTC (rev 26134)
+++ Zope3/trunk/src/zope/app/cache/caching.py	2004-07-06 19:43:35 UTC (rev 26135)
@@ -21,7 +21,9 @@
 
 def getCacheForObject(obj):
     """Returns the cache associated with obj or None."""
-    adapter = ICacheable(obj)
+    adapter = ICacheable(obj, None)
+    if adapter is None:
+        return None
     cache_id = adapter.getCacheId()
     if not cache_id:
         return None



More information about the Zope3-Checkins mailing list