server/repository.py
changeset 7794 aed065b97f12
parent 7784 7f5c455ec7d1
child 7797 a71618a75b53
equal deleted inserted replaced
7792:163d25c9fdd2 7794:aed065b97f12
   457         return cwuser
   457         return cwuser
   458 
   458 
   459     def _build_user(self, session, eid):
   459     def _build_user(self, session, eid):
   460         """return a CWUser entity for user with the given eid"""
   460         """return a CWUser entity for user with the given eid"""
   461         cls = self.vreg['etypes'].etype_class('CWUser')
   461         cls = self.vreg['etypes'].etype_class('CWUser')
   462         rql = cls.fetch_rql(session.user, ['X eid %(x)s'])
   462         st = cls.fetch_rqlst(session.user, ordermethod=None)
   463         rset = session.execute(rql, {'x': eid})
   463         st.add_eid_restriction(st.get_variable('X'), 'x', 'Substitute')
       
   464         rset = session.execute(st.as_string(), {'x': eid})
   464         assert len(rset) == 1, rset
   465         assert len(rset) == 1, rset
   465         cwuser = rset.get_entity(0, 0)
   466         cwuser = rset.get_entity(0, 0)
   466         # pylint: disable=W0104
   467         # pylint: disable=W0104
   467         # prefetch / cache cwuser's groups and properties. This is especially
   468         # prefetch / cache cwuser's groups and properties. This is especially
   468         # useful for internal sessions to avoid security insertions
   469         # useful for internal sessions to avoid security insertions