server/session.py
changeset 8265 9747ab9230ad
parent 8190 2a3c1b787688
child 8306 4da49700b06a
equal deleted inserted replaced
8262:272e10526679 8265:9747ab9230ad
   250         self.user = user
   250         self.user = user
   251         self.repo = repo
   251         self.repo = repo
   252         self.cnxtype = cnxprops.cnxtype
   252         self.cnxtype = cnxprops.cnxtype
   253         self.timestamp = time()
   253         self.timestamp = time()
   254         self.default_mode = 'read'
   254         self.default_mode = 'read'
   255         # support undo for Create Update Delete entity / Add Remove relation
   255         # undo support
   256         if repo.config.creating or repo.config.repairing or self.is_internal_session:
   256         if repo.config.creating or repo.config.repairing or self.is_internal_session:
   257             self.undo_actions = ()
   257             self.undo_actions = False
   258         else:
   258         else:
   259             self.undo_actions = set(repo.config['undo-support'].upper())
   259             self.undo_actions = repo.config['undo-support']
   260             if self.undo_actions - set('CUDAR'):
       
   261                 raise Exception('bad undo-support string in configuration')
       
   262         # short cut to querier .execute method
   260         # short cut to querier .execute method
   263         self._execute = repo.querier.execute
   261         self._execute = repo.querier.execute
   264         # shared data, used to communicate extra information between the client
   262         # shared data, used to communicate extra information between the client
   265         # and the rql server
   263         # and the rql server
   266         self.data = {}
   264         self.data = {}
  1116         else:
  1114         else:
  1117             self.pending_operations.insert(index, operation)
  1115             self.pending_operations.insert(index, operation)
  1118 
  1116 
  1119     # undo support ############################################################
  1117     # undo support ############################################################
  1120 
  1118 
  1121     def undoable_action(self, action, ertype):
  1119     def ertype_supports_undo(self, ertype):
  1122         return action in self.undo_actions and not ertype in NO_UNDO_TYPES
  1120         return self.undo_actions  and ertype not in NO_UNDO_TYPES
  1123         # XXX elif transaction on mark it partial
       
  1124 
  1121 
  1125     def transaction_uuid(self, set=True):
  1122     def transaction_uuid(self, set=True):
  1126         try:
  1123         try:
  1127             return self.transaction_data['tx_uuid']
  1124             return self.transaction_data['tx_uuid']
  1128         except KeyError:
  1125         except KeyError: