[req] deprecate get_cache (closes #3181499)
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Tue, 21 Jan 2014 17:01:33 +0100
changeset 9442 fbf2287fb2ce
parent 9405 7fc5e13d049f
child 9443 6ff9401c37c1
[req] deprecate get_cache (closes #3181499)
entities/lib.py
req.py
--- a/entities/lib.py	Mon Jan 13 16:08:38 2014 +0100
+++ b/entities/lib.py	Tue Jan 21 17:01:33 2014 +0100
@@ -18,6 +18,7 @@
 """entity classes for optional library entities"""
 
 __docformat__ = "restructuredtext en"
+from warnings import warn
 
 from urlparse import urlsplit, urlunsplit
 from datetime import datetime
@@ -130,6 +131,13 @@
     __regid__ = 'CWCache'
     fetch_attrs, cw_fetch_order = fetch_config(['name'])
 
+    def __init__(self, *args, **kwargs):
+        warn('[3.19] CWCache entity type is going away soon. '
+             'Other caching mechanisms can be used more reliably '
+             'to the same effect.',
+             DeprecationWarning)
+        super(CWCache, self).__init__(*args, **kwargs)
+
     def touch(self):
         self._cw.execute('SET X timestamp %(t)s WHERE X eid %(x)s',
                          {'t': datetime.now(), 'x': self.eid})
--- a/req.py	Mon Jan 13 16:08:38 2014 +0100
+++ b/req.py	Tue Jan 21 17:01:33 2014 +0100
@@ -241,6 +241,11 @@
         - cubes.blog.mycache
         - etc.
         """
+        warn.warning('[3.19] .get_cache will disappear soon. '
+                     'Distributed caching mechanisms are being introduced instead.'
+                     'Other caching mechanism can be used more reliably '
+                     'to the same effect.',
+                     DeprecationWarning)
         if cachename in CACHE_REGISTRY:
             cache = CACHE_REGISTRY[cachename]
         else: