[entity] clearing adapters cache in clear_relations_cache avoid weird caching issue, notably on repository session's user
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 21 May 2010 18:39:40 +0200
changeset 5573 8dfb1726526b
parent 5572 df5551d697e8
child 5574 e082a57c2207
[entity] clearing adapters cache in clear_relations_cache avoid weird caching issue, notably on repository session's user
entity.py
--- a/entity.py	Fri May 21 15:06:29 2010 +0200
+++ b/entity.py	Fri May 21 18:39:40 2010 +0200
@@ -937,6 +937,7 @@
         """
         if rtype is None:
             self._cw_related_cache = {}
+            self._cw_adapters_cache = {}
         else:
             assert role
             self._cw_related_cache.pop('%s_%s' % (rtype, role), None)
@@ -953,17 +954,12 @@
         self._cw_completed = False
         self.clear()
         # clear relations cache
-        for rschema, _, role in self.e_schema.relation_definitions():
-            self.cw_clear_relation_cache(rschema.type, role)
+        self.cw_clear_relation_cache()
         # rest path unique cache
         try:
             del self.__unique
         except AttributeError:
             pass
-        try:
-            del self._cw_adapters_cache
-        except AttributeError:
-            pass
 
     # raw edition utilities ###################################################