[Erp5-report] r18944 - /erp5/trunk/products/ERP5Type/Cache.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Jan 31 14:50:42 CET 2008
Author: jerome
Date: Thu Jan 31 14:50:42 2008
New Revision: 18944
URL: http://svn.erp5.org?rev=18944&view=rev
Log:
use warnings.warn for clearCache to get the message only once
Modified:
erp5/trunk/products/ERP5Type/Cache.py
Modified: erp5/trunk/products/ERP5Type/Cache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Cache.py?rev=18944&r1=18943&r2=18944&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Cache.py (original)
+++ erp5/trunk/products/ERP5Type/Cache.py Thu Jan 31 14:50:42 2008
@@ -32,7 +32,7 @@
from CachePlugins.BaseCache import CachedMethodError
from zLOG import LOG, WARNING
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
-from traceback import extract_stack
+from warnings import warn
DEFAULT_CACHE_SCOPE = 'GLOBAL'
DEFAULT_CACHE_FACTORY = 'erp5_ui_short'
@@ -252,10 +252,9 @@
def clearCache(cache_factory_list=(DEFAULT_CACHE_FACTORY,)):
"""Clear specified cache factory list."""
- filename, line, function, text = extract_stack(limit=2)[0]
- LOG("%s:%i" % (filename, line), \
- WARNING, \
- "Global function clearCache() is deprecated. Use portal_caches.clearCache() instead.")
+ warn("Global function clearCache() is deprecated. Use"
+ " portal_caches.clearCache() instead.", DeprecationWarning,
+ stacklevel=2)
cache_storage = CachingMethod.factories
for cf_key in cache_factory_list:
if cache_storage.has_key(cf_key):
More information about the Erp5-report
mailing list