[entity] generic clear_all_caches methods, to use in test 3.5
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 21 Aug 2009 08:31:25 +0200
branch3.5
changeset 2942 77ebdbe93cf8
parent 2941 196493bd099c
child 2943 77622caef9bd
[entity] generic clear_all_caches methods, to use in test
entity.py
--- a/entity.py	Fri Aug 21 08:31:01 2009 +0200
+++ b/entity.py	Fri Aug 21 08:31:25 2009 +0200
@@ -825,6 +825,11 @@
             assert role
             self._related_cache.pop('%s_%s' % (rtype, role), None)
 
+    def clear_all_caches(self):
+        self.clear()
+        for rschema, _, role in self.e_schema.relation_definitions():
+            self.clear_related_cache(rschema.type, role)
+
     # raw edition utilities ###################################################
 
     def set_attributes(self, _cw_unsafe=False, **kwargs):