[rset] better explanation, refactor try except
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 14 Aug 2009 09:17:28 +0200
changeset 2832 7fb67c54ffb9
parent 2831 ddde6cf856a1
child 2833 9aa47a3c0dfe
[rset] better explanation, refactor try except
rset.py
--- a/rset.py	Thu Aug 13 13:08:27 2009 +0200
+++ b/rset.py	Fri Aug 14 09:17:28 2009 +0200
@@ -422,16 +422,17 @@
         #     new attributes found in this resultset ?
         try:
             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
+        else:
+            if entity.rset is None:
+                # entity has no rset set, this means entity has been created by
+                # the querier (req is a repository session) and so jas no rset
+                # info. Add it.
+                entity.cw_rset = self
+                entity.cw_row = row
+                entity.cw_col = col
+            return entity
         # build entity instance
         etype = self.description[row][col]
         entity = self.vreg['etypes'].etype_class(etype)(req, rset=self,