server/session.py
changeset 9075 8d36838ccb3e
parent 9074 0616f7a713c6
child 9076 7743e7b29635
equal deleted inserted replaced
9074:0616f7a713c6 9075:8d36838ccb3e
   684         return self.undo_actions and ertype not in NO_UNDO_TYPES
   684         return self.undo_actions and ertype not in NO_UNDO_TYPES
   685 
   685 
   686     def transaction_uuid(self, set=True):
   686     def transaction_uuid(self, set=True):
   687         uuid = self.transaction_data.get('tx_uuid')
   687         uuid = self.transaction_data.get('tx_uuid')
   688         if set and uuid is None:
   688         if set and uuid is None:
   689             raise KeyError
   689             self.transaction_data['tx_uuid'] = uuid = uuid4().hex
       
   690             self.repo.system_source.start_undoable_transaction(self, uuid)
   690         return uuid
   691         return uuid
   691 
   692 
   692     def transaction_inc_action_counter(self):
   693     def transaction_inc_action_counter(self):
   693         num = self.transaction_data.setdefault('tx_action_count', 0) + 1
   694         num = self.transaction_data.setdefault('tx_action_count', 0) + 1
   694         self.transaction_data['tx_action_count'] = num
   695         self.transaction_data['tx_action_count'] = num
  1430 
  1431 
  1431     # undo support ############################################################
  1432     # undo support ############################################################
  1432 
  1433 
  1433     ertype_supports_undo = cnx_meth('ertype_supports_undo')
  1434     ertype_supports_undo = cnx_meth('ertype_supports_undo')
  1434     transaction_inc_action_counter = cnx_meth('transaction_inc_action_counter')
  1435     transaction_inc_action_counter = cnx_meth('transaction_inc_action_counter')
  1435 
  1436     transaction_uuid = cnx_meth('transaction_uuid')
  1436     def transaction_uuid(self, set=True):
       
  1437         try:
       
  1438             return self._cnx.transaction_uuid(set=set)
       
  1439         except KeyError:
       
  1440             self._cnx.transaction_data['tx_uuid'] = uuid = uuid4().hex
       
  1441             self.repo.system_source.start_undoable_transaction(self, uuid)
       
  1442             return uuid
       
  1443 
  1437 
  1444     # querier helpers #########################################################
  1438     # querier helpers #########################################################
  1445 
  1439 
  1446     rql_rewriter = cnx_attr('_rewriter')
  1440     rql_rewriter = cnx_attr('_rewriter')
  1447 
  1441