F [rset repo cache] set entity.rset when no set on entities retreived from the cache
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 03 Aug 2009 09:24:08 +0200
changeset 2648 4ae7d02ce063
parent 2647 b0a2e779845c
child 2649 5d4a943695d1
F [rset repo cache] set entity.rset when no set on entities retreived from the cache
rset.py
--- a/rset.py	Sun Aug 02 12:00:17 2009 +0200
+++ b/rset.py	Mon Aug 03 09:24:08 2009 +0200
@@ -370,7 +370,15 @@
         # XXX should we consider updating a cached entity with possible
         #     new attributes found in this resultset ?
         try:
-            return req.entity_cache(eid)
+            entity = req.entity_cache(eid)
+            if entity.rset is None:
+                # entity has no rset set, this means entity has been cached by
+                # the repository (req is a repository session) which had no rset
+                # info. Add id.
+                entity.rset = self
+                entity.row = row
+                entity.col = col
+            return entity
         except KeyError:
             pass
         # build entity instance