server/repository.py
changeset 9020 cb87e831c183
parent 9008 e0aa7cf8abf8
child 9033 614bf73cc126
equal deleted inserted replaced
9019:e08f9c55dab5 9020:cb87e831c183
   853     def commit(self, sessionid, txid=None):
   853     def commit(self, sessionid, txid=None):
   854         """commit transaction for the session with the given id"""
   854         """commit transaction for the session with the given id"""
   855         self.debug('begin commit for session %s', sessionid)
   855         self.debug('begin commit for session %s', sessionid)
   856         try:
   856         try:
   857             session = self._get_session(sessionid)
   857             session = self._get_session(sessionid)
   858             session.set_tx(txid)
   858             session.set_cnx(txid)
   859             return session.commit()
   859             return session.commit()
   860         except (ValidationError, Unauthorized):
   860         except (ValidationError, Unauthorized):
   861             raise
   861             raise
   862         except Exception:
   862         except Exception:
   863             self.exception('unexpected error')
   863             self.exception('unexpected error')
   866     def rollback(self, sessionid, txid=None):
   866     def rollback(self, sessionid, txid=None):
   867         """commit transaction for the session with the given id"""
   867         """commit transaction for the session with the given id"""
   868         self.debug('begin rollback for session %s', sessionid)
   868         self.debug('begin rollback for session %s', sessionid)
   869         try:
   869         try:
   870             session = self._get_session(sessionid)
   870             session = self._get_session(sessionid)
   871             session.set_tx(txid)
   871             session.set_cnx(txid)
   872             session.rollback()
   872             session.rollback()
   873         except Exception:
   873         except Exception:
   874             self.exception('unexpected error')
   874             self.exception('unexpected error')
   875             raise
   875             raise
   876 
   876 
  1025         try:
  1025         try:
  1026             session = self._sessions[sessionid]
  1026             session = self._sessions[sessionid]
  1027         except KeyError:
  1027         except KeyError:
  1028             raise BadConnectionId('No such session %s' % sessionid)
  1028             raise BadConnectionId('No such session %s' % sessionid)
  1029         if setcnxset:
  1029         if setcnxset:
  1030             session.set_tx(txid) # must be done before set_cnxset
  1030             session.set_cnx(txid) # must be done before set_cnxset
  1031             session.set_cnxset()
  1031             session.set_cnxset()
  1032         return session
  1032         return session
  1033 
  1033 
  1034     # data sources handling ###################################################
  1034     # data sources handling ###################################################
  1035     # * correspondance between eid and (type, source)
  1035     # * correspondance between eid and (type, source)