rset.py
changeset 2648 4ae7d02ce063
parent 2647 b0a2e779845c
child 2650 18aec79ec3a3
equal deleted inserted replaced
2647:b0a2e779845c 2648:4ae7d02ce063
   368         assert eid is not None
   368         assert eid is not None
   369         # return cached entity if exists. This also avoids potential recursion
   369         # return cached entity if exists. This also avoids potential recursion
   370         # XXX should we consider updating a cached entity with possible
   370         # XXX should we consider updating a cached entity with possible
   371         #     new attributes found in this resultset ?
   371         #     new attributes found in this resultset ?
   372         try:
   372         try:
   373             return req.entity_cache(eid)
   373             entity = req.entity_cache(eid)
       
   374             if entity.rset is None:
       
   375                 # entity has no rset set, this means entity has been cached by
       
   376                 # the repository (req is a repository session) which had no rset
       
   377                 # info. Add id.
       
   378                 entity.rset = self
       
   379                 entity.row = row
       
   380                 entity.col = col
       
   381             return entity
   374         except KeyError:
   382         except KeyError:
   375             pass
   383             pass
   376         # build entity instance
   384         # build entity instance
   377         etype = self.description[row][col]
   385         etype = self.description[row][col]
   378         entity = self.vreg.etype_class(etype)(req, self, row, col)
   386         entity = self.vreg.etype_class(etype)(req, self, row, col)