web/request.py
changeset 9582 46ed25d38fe2
parent 9568 e8b9a3d23ad9
child 9601 e5a80bd337e8
--- a/web/request.py	Mon Mar 24 16:38:57 2014 +0100
+++ b/web/request.py	Mon Mar 24 11:57:23 2014 +0100
@@ -1025,8 +1025,6 @@
         from cubicweb.dbapi import DBAPISession, _NeedAuthAccessMock
         self.session = DBAPISession(None)
         self.cnx = self.user = _NeedAuthAccessMock()
-        #: cache entities built during the request
-        self._eid_cache = {}
 
     def set_cnx(self, cnx):
         self.cnx = cnx
@@ -1070,20 +1068,11 @@
 
     # entities cache management ###############################################
 
-    def entity_cache(self, eid):
-        return self._eid_cache[eid]
-
-    def set_entity_cache(self, entity):
-        self._eid_cache[entity.eid] = entity
+    entity_cache = _cnx_func('entity_cache')
+    set_entity_cache = _cnx_func('set_entity_cache')
+    cached_entities = _cnx_func('cached_entities')
+    drop_entity_cache = _cnx_func('drop_entity_cache')
 
-    def cached_entities(self):
-        return self._eid_cache.values()
-
-    def drop_entity_cache(self, eid=None):
-        if eid is None:
-            self._eid_cache = {}
-        else:
-            del self._eid_cache[eid]