Commit ac2a4cf1 authored by Jérome Perrin's avatar Jérome Perrin

use warnings.warn for clearCache to get the message only once



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18944 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 97d98352
...@@ -32,7 +32,7 @@ from AccessControl.SecurityInfo import allow_class ...@@ -32,7 +32,7 @@ from AccessControl.SecurityInfo import allow_class
from CachePlugins.BaseCache import CachedMethodError from CachePlugins.BaseCache import CachedMethodError
from zLOG import LOG, WARNING from zLOG import LOG, WARNING
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from traceback import extract_stack from warnings import warn
DEFAULT_CACHE_SCOPE = 'GLOBAL' DEFAULT_CACHE_SCOPE = 'GLOBAL'
DEFAULT_CACHE_FACTORY = 'erp5_ui_short' DEFAULT_CACHE_FACTORY = 'erp5_ui_short'
...@@ -252,10 +252,9 @@ def disableReadOnlyTransactionCache(context): ...@@ -252,10 +252,9 @@ def disableReadOnlyTransactionCache(context):
def clearCache(cache_factory_list=(DEFAULT_CACHE_FACTORY,)): def clearCache(cache_factory_list=(DEFAULT_CACHE_FACTORY,)):
"""Clear specified cache factory list.""" """Clear specified cache factory list."""
filename, line, function, text = extract_stack(limit=2)[0] warn("Global function clearCache() is deprecated. Use"
LOG("%s:%i" % (filename, line), \ " portal_caches.clearCache() instead.", DeprecationWarning,
WARNING, \ stacklevel=2)
"Global function clearCache() is deprecated. Use portal_caches.clearCache() instead.")
cache_storage = CachingMethod.factories cache_storage = CachingMethod.factories
for cf_key in cache_factory_list: for cf_key in cache_factory_list:
if cache_storage.has_key(cf_key): if cache_storage.has_key(cf_key):
......
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