diff --git a/product/ERP5Type/Tool/CacheTool.py b/product/ERP5Type/Tool/CacheTool.py index ba02fbaa44ddf28aa15dee881cc56a9156be8b70..e4fe94bee87842cc257907a9f82580c5bd6a52da 100644 --- a/product/ERP5Type/Tool/CacheTool.py +++ b/product/ERP5Type/Tool/CacheTool.py @@ -82,18 +82,16 @@ class CacheTool(BaseTool): elif cp_meta_type == 'ERP5 Distributed Ram Cache': ## even thougn we have such plugin in ZODB that doens't mean ## we have corresponding memcache module installed - memcached_plugin = cp.getSpecialiseValue() - if memcached_plugin is not None: - init_dict = { - 'server': memcached_plugin.getUrlString(), - 'server_max_key_length': memcached_plugin.getServerMaxKeyLength(), - 'server_max_value_length': memcached_plugin.getServerMaxValueLength(), - } - cache_obj = DistributedRamCache(init_dict) - else: - ## we don't have memcache python module installed - ## thus we can't use DistributedRamCache plugin - cache_obj = None + cache_obj = None + if getattr(cp, 'getSpecialiseValue', None) is not None: + memcached_plugin = cp.getSpecialiseValue() + if memcached_plugin is not None: + init_dict = { + 'server': memcached_plugin.getUrlString(), + 'server_max_key_length': memcached_plugin.getServerMaxKeyLength(), + 'server_max_value_length': memcached_plugin.getServerMaxValueLength(), + } + cache_obj = DistributedRamCache(init_dict) if cache_obj is not None: ## set cache expire check interval cache_obj.cache_expire_check_interval = cp.getCacheExpireCheckInterval() diff --git a/product/ERP5Type/Tool/MemcachedTool.py b/product/ERP5Type/Tool/MemcachedTool.py index 48eeeaafd506d33415859c11a431c66882702821..445595963e1aefc25f68e12e2c061e3725957612 100644 --- a/product/ERP5Type/Tool/MemcachedTool.py +++ b/product/ERP5Type/Tool/MemcachedTool.py @@ -263,7 +263,7 @@ if memcache is not None: id = "portal_memcached" meta_type = "ERP5 Memcached Tool" portal_type = "Memcached Tool" - + security = ClassSecurityInfo() manage_options = ({'label': 'Configure', 'action': 'memcached_tool_configure', @@ -282,7 +282,8 @@ if memcache is not None: memcached_plugin = self.restrictedTraverse(plugin_path, None) if memcached_plugin is None: raise ValueError, 'Memcached Plugin does not exists: %r' % (plugin_path,) - dictionary = MemcachedDict((memcached_plugin.getUrlString(),), + url_string = memcached_plugin.getUrlString('')[len('memcached://'):] + dictionary = MemcachedDict((url_string,), server_max_key_length=memcached_plugin.getServerMaxKeyLength(), server_max_value_length=memcached_plugin.getServerMaxValueLength()) memcached_dict_pool.memcached_dict = dictionary