--- lib/python/Products/StandardCacheManagers/RAMCacheManager.py 14 Aug 2002 22:25:12 -0000 1.10 +++ taste/the/fun/RAMCacheManager.py 28 May 2003 07:22:16 -0000 @@ -18,23 +18,20 @@ ''' -from OFS.Cache import Cache, CacheManager +from OFS.Cache import Cache, CacheManager, CacheException from OFS.SimpleItem import SimpleItem from thread import allocate_lock import time 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. ''' @@ -52,8 +49,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