entity.py
changeset 5762 730d458ec1bf
parent 5736 375819ec7d43
parent 5757 e501806ab489
child 5797 7183f32fad13
equal deleted inserted replaced
5754:51179e0bb250 5762:730d458ec1bf
   779         """
   779         """
   780         try:
   780         try:
   781             return self._cw_relation_cache(rtype, role, entities, limit)
   781             return self._cw_relation_cache(rtype, role, entities, limit)
   782         except KeyError:
   782         except KeyError:
   783             pass
   783             pass
   784         assert self.has_eid()
   784         if not self.has_eid():
       
   785             if entities:
       
   786                 return []
       
   787             return self.empty_rset()
   785         rql = self.cw_related_rql(rtype, role)
   788         rql = self.cw_related_rql(rtype, role)
   786         rset = self._cw.execute(rql, {'x': self.eid})
   789         rset = self._cw.execute(rql, {'x': self.eid})
   787         self.cw_set_relation_cache(rtype, role, rset)
   790         self.cw_set_relation_cache(rtype, role, rset)
   788         return self.related(rtype, role, limit, entities)
   791         return self.related(rtype, role, limit, entities)
   789 
   792