Commit 533d05a3 authored by Ivan Tyagov's avatar Ivan Tyagov

Fixed some dirty code.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11116 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f54f5385
...@@ -63,7 +63,7 @@ class DistributedRamCache(BaseCache): ...@@ -63,7 +63,7 @@ class DistributedRamCache(BaseCache):
except ImportError: except ImportError:
request = None request = None
if request: if request is not None:
## Zope/ERP5 environment ## Zope/ERP5 environment
memcache_conn = request.get('_erp5_memcache_connection', None) memcache_conn = request.get('_erp5_memcache_connection', None)
if not memcache_conn: if not memcache_conn:
......
...@@ -124,7 +124,7 @@ class SQLCache(BaseCache): ...@@ -124,7 +124,7 @@ class SQLCache(BaseCache):
except ImportError: except ImportError:
request = None request = None
if request: if request is not None:
## Zope/ERP5 environment ## Zope/ERP5 environment
dbConn = request.get('_erp5_dbcache_connection', None) dbConn = request.get('_erp5_dbcache_connection', None)
if not dbConn: if not dbConn:
......
...@@ -110,7 +110,7 @@ class CacheTool(BaseTool): ...@@ -110,7 +110,7 @@ class CacheTool(BaseTool):
except: except:
pass pass
self.erp5_sql_transactionless_connection.manage_test(my_query) self.erp5_sql_transactionless_connection.manage_test(my_query)
if REQUEST: if REQUEST is not None:
self.REQUEST.RESPONSE.redirect('cache_tool_configure?portal_status_message=Cache table successfully created.') self.REQUEST.RESPONSE.redirect('cache_tool_configure?portal_status_message=Cache table successfully created.')
security.declareProtected(Permissions.AccessContentsInformation, 'parseDBConnectionString') security.declareProtected(Permissions.AccessContentsInformation, 'parseDBConnectionString')
...@@ -169,7 +169,7 @@ class CacheTool(BaseTool): ...@@ -169,7 +169,7 @@ class CacheTool(BaseTool):
for key,item in self.getCacheFactoryList().items(): for key,item in self.getCacheFactoryList().items():
if len(item['cache_plugins'])!=0: if len(item['cache_plugins'])!=0:
CachingMethod.factories[key] = CacheFactory(item['cache_plugins'], item['cache_params']) CachingMethod.factories[key] = CacheFactory(item['cache_plugins'], item['cache_params'])
if REQUEST: if REQUEST is not None:
self.REQUEST.RESPONSE.redirect('cache_tool_configure?portal_status_message=Cache updated.') self.REQUEST.RESPONSE.redirect('cache_tool_configure?portal_status_message=Cache updated.')
security.declareProtected(Permissions.ModifyPortalContent, 'clearCache') security.declareProtected(Permissions.ModifyPortalContent, 'clearCache')
...@@ -179,7 +179,7 @@ class CacheTool(BaseTool): ...@@ -179,7 +179,7 @@ class CacheTool(BaseTool):
for cf in ram_cache_root: for cf in ram_cache_root:
for cp in ram_cache_root[cf].getCachePluginList(): for cp in ram_cache_root[cf].getCachePluginList():
cp.clearCache() cp.clearCache()
if REQUEST: if REQUEST is not None:
self.REQUEST.RESPONSE.redirect('cache_tool_configure?portal_status_message=Cache cleared.') self.REQUEST.RESPONSE.redirect('cache_tool_configure?portal_status_message=Cache cleared.')
security.declareProtected(Permissions.ModifyPortalContent, 'clearCacheFactory') security.declareProtected(Permissions.ModifyPortalContent, 'clearCacheFactory')
...@@ -188,7 +188,7 @@ class CacheTool(BaseTool): ...@@ -188,7 +188,7 @@ class CacheTool(BaseTool):
ram_cache_root = self.getRamCacheRoot() ram_cache_root = self.getRamCacheRoot()
if ram_cache_root.has_key(cache_factory_id): if ram_cache_root.has_key(cache_factory_id):
ram_cache_root[cache_factory_id].clearCache() ram_cache_root[cache_factory_id].clearCache()
if REQUEST: if REQUEST is not None:
self.REQUEST.RESPONSE.redirect('cache_tool_configure?portal_status_message=Cache factory %s cleared.' %cache_factory_id) self.REQUEST.RESPONSE.redirect('cache_tool_configure?portal_status_message=Cache factory %s cleared.' %cache_factory_id)
security.declareProtected(Permissions.ModifyPortalContent, 'clearCacheFactoryScope') security.declareProtected(Permissions.ModifyPortalContent, 'clearCacheFactoryScope')
...@@ -197,6 +197,6 @@ class CacheTool(BaseTool): ...@@ -197,6 +197,6 @@ class CacheTool(BaseTool):
ram_cache_root = self.getRamCacheRoot() ram_cache_root = self.getRamCacheRoot()
if ram_cache_root.has_key(cache_factory_id): if ram_cache_root.has_key(cache_factory_id):
ram_cache_root[cache_factory_id].clearCacheForScope(scope) ram_cache_root[cache_factory_id].clearCacheForScope(scope)
if REQUEST: if REQUEST is not None:
self.REQUEST.RESPONSE.redirect('cache_tool_configure?portal_status_message=Cache factory scope %s cleared.' %cache_factory_id) self.REQUEST.RESPONSE.redirect('cache_tool_configure?portal_status_message=Cache factory scope %s cleared.' %cache_factory_id)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment