force cache clear when external entity is edited, we don't know what may occurs in external repository hooks 3.5
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 27 Aug 2009 17:04:50 +0200
branch3.5
changeset 3043 7bcb7f1c0f46
parent 3042 d2455badf7fb
child 3044 27ded3bbd105
force cache clear when external entity is edited, we don't know what may occurs in external repository hooks
server/sources/pyrorql.py
--- a/server/sources/pyrorql.py	Thu Aug 27 17:03:19 2009 +0200
+++ b/server/sources/pyrorql.py	Thu Aug 27 17:04:50 2009 +0200
@@ -345,6 +345,7 @@
         cu.execute('SET %s WHERE X eid %%(x)s' % ','.join(relations),
                    kwargs, 'x')
         self._query_cache.clear()
+        entity.clear_all_caches()
 
     def delete_entity(self, session, etype, eid):
         """delete an entity from the source"""
@@ -360,6 +361,8 @@
                    {'x': self.eid2extid(subject, session),
                     'y': self.eid2extid(object, session)}, ('x', 'y'))
         self._query_cache.clear()
+        session.entity_from_eid(subject).clear_all_caches()
+        session.entity_from_eid(object).clear_all_caches()
 
     def delete_relation(self, session, subject, rtype, object):
         """delete a relation from the source"""
@@ -368,6 +371,8 @@
                    {'x': self.eid2extid(subject, session),
                     'y': self.eid2extid(object, session)}, ('x', 'y'))
         self._query_cache.clear()
+        session.entity_from_eid(subject).clear_all_caches()
+        session.entity_from_eid(object).clear_all_caches()
 
 
 class RQL2RQL(object):