[Erp5-report] r28902 - /erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Sep 10 17:14:19 CEST 2009


Author: nicolas
Date: Thu Sep 10 17:14:17 2009
New Revision: 28902

URL: http://svn.erp5.org?rev=28902&view=rev
Log:
Some chars are not allowed by memcached to build the key, so clean them up

Modified:
    erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py

Modified: erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py?rev=28902&r1=28901&r2=28902&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py [utf8] Thu Sep 10 17:14:17 2009
@@ -36,6 +36,7 @@
 from BaseCache import CacheEntry
 from Products.ERP5Type import interfaces
 import zope.interface
+import string
 
 try:
   import memcache
@@ -105,6 +106,8 @@
     ## such behaviour when constructing cache_id we add scope in front
     cache_id = "%s%s%s%s" % (self._key_prefix, self._cache_plugin_path,
                              scope, cache_id)
+    #Some chars are not allowed by memcached to build the key
+    cache_id = cache_id.translate(string.maketrans('', ''), '[]()<>\'", ')
     if self._server_max_key_length != 0:
       ## memcached will fail to store cache_id longer than MEMCACHED_SERVER_MAX_KEY_LENGTH.
       return cache_id[:self._server_max_key_length]




More information about the Erp5-report mailing list