--- lib/python/Products/StandardCacheManagers/RAMCacheManager.py 15 Jan 2004 22:54:11 -0000 1.11 +++ taste/the/fun/RAMCacheManager.py 18 Jan 2004 10:28:43 -0000 @@ -18,7 +18,7 @@ ''' -from OFS.Cache import Cache, CacheManager +from OFS.Cache import Cache, CacheManager, CacheException from OFS.SimpleItem import SimpleItem from thread import allocate_lock from cgi import escape @@ -26,16 +26,13 @@ import Globals from Globals import DTMLFile -try: from cPickle import Pickler -except: from pickle import Pickler - -try: from cStringIO import dumps -except: from pickle import dumps +try: from cPickle import PicklingError, dumps +except ImportError: from pickle import PicklingError, dumps _marker = [] # Create a new marker object. -class CacheException (Exception): +class CacheEntryError(CacheException): ''' A cache-related exception. ''' @@ -53,8 +50,8 @@ # leaks. It's also convenient for determining the # approximate memory usage of the cache entry. self.size = len(dumps(index)) + len(dumps(data)) - except: - raise CacheException('The data for the cache is not pickleable.') + except PicklingError: + raise CacheEntryError('The data for the cache is not pickleable.') self.created = time.time() self.data = data self.view_name = view_name