server/session.py
branchstable
changeset 9194 4e1946bd9ea2
parent 9143 1890e0df68fa
child 9221 e9a3a22f98b7
equal deleted inserted replaced
9193:eaa58d1c7d5f 9194:4e1946bd9ea2
  1257                             print operation
  1257                             print operation
  1258                         operation.handle_event('precommit_event')
  1258                         operation.handle_event('precommit_event')
  1259                     self.pending_operations[:] = processed
  1259                     self.pending_operations[:] = processed
  1260                     self.debug('precommit session %s done', self.id)
  1260                     self.debug('precommit session %s done', self.id)
  1261                 except BaseException:
  1261                 except BaseException:
       
  1262                     # save exception context, it may be clutered below by
       
  1263                     # exception in revert_* event
       
  1264                     exc_info = sys.exc_info()
  1262                     # if error on [pre]commit:
  1265                     # if error on [pre]commit:
  1263                     #
  1266                     #
  1264                     # * set .failed = True on the operation causing the failure
  1267                     # * set .failed = True on the operation causing the failure
  1265                     # * call revert<event>_event on processed operations
  1268                     # * call revert<event>_event on processed operations
  1266                     # * call rollback_event on *all* operations
  1269                     # * call rollback_event on *all* operations
  1282                                           exc_info=True)
  1285                                           exc_info=True)
  1283                     # XXX use slice notation since self.pending_operations is a
  1286                     # XXX use slice notation since self.pending_operations is a
  1284                     # read-only property.
  1287                     # read-only property.
  1285                     self.pending_operations[:] = processed + self.pending_operations
  1288                     self.pending_operations[:] = processed + self.pending_operations
  1286                     self.rollback(free_cnxset)
  1289                     self.rollback(free_cnxset)
  1287                     raise
  1290                     raise exc_info[0], exc_info[1], exc_info[2]
  1288                 self.cnxset.commit()
  1291                 self.cnxset.commit()
  1289                 self.commit_state = 'postcommit'
  1292                 self.commit_state = 'postcommit'
  1290                 if debug:
  1293                 if debug:
  1291                     print self.commit_state, '*' * 20
  1294                     print self.commit_state, '*' * 20
  1292                 while self.pending_operations:
  1295                 while self.pending_operations: