server/repository.py
changeset 10336 9c38f674e36f
parent 10315 0f3489d622ba
child 10337 c8bb743850c9
equal deleted inserted replaced
10335:88a4e4a60fce 10336:9c38f674e36f
   661         return session
   661         return session
   662 
   662 
   663     def connect(self, login, **kwargs):
   663     def connect(self, login, **kwargs):
   664         """open a new session for a given user and return its sessionid """
   664         """open a new session for a given user and return its sessionid """
   665         return self.new_session(login, **kwargs).sessionid
   665         return self.new_session(login, **kwargs).sessionid
   666 
       
   667     def execute(self, sessionid, rqlstring, args=None, build_descr=True,
       
   668                 txid=None):
       
   669         """execute a RQL query
       
   670 
       
   671         * rqlstring should be a unicode string or a plain ascii string
       
   672         * args the optional parameters used in the query
       
   673         * build_descr is a flag indicating if the description should be
       
   674           built on select queries
       
   675         """
       
   676         session = self._get_session(sessionid, setcnxset=True, txid=txid)
       
   677         try:
       
   678             try:
       
   679                 rset = self.querier.execute(session, rqlstring, args,
       
   680                                             build_descr)
       
   681                 return rset
       
   682             except (ValidationError, Unauthorized, RQLSyntaxError):
       
   683                 raise
       
   684             except Exception:
       
   685                 # FIXME: check error to catch internal errors
       
   686                 self.exception('unexpected error while executing %s with %s', rqlstring, args)
       
   687                 raise
       
   688         finally:
       
   689             session.free_cnxset()
       
   690 
   666 
   691     @deprecated('[3.19] use .entity_metas(sessionid, eid, txid) instead')
   667     @deprecated('[3.19] use .entity_metas(sessionid, eid, txid) instead')
   692     def describe(self, sessionid, eid, txid=None):
   668     def describe(self, sessionid, eid, txid=None):
   693         """return a tuple `(type, physical source uri, extid, actual source
   669         """return a tuple `(type, physical source uri, extid, actual source
   694         uri)` for the entity of the given `eid`
   670         uri)` for the entity of the given `eid`