cubicweb/server/session.py
changeset 12542 85194bd49119
parent 12539 10159a3d1d72
child 12567 26744ad37953
equal deleted inserted replaced
12541:bbbccb0b3a66 12542:85194bd49119
    20 from __future__ import print_function
    20 from __future__ import print_function
    21 
    21 
    22 import functools
    22 import functools
    23 import sys
    23 import sys
    24 from uuid import uuid4
    24 from uuid import uuid4
    25 from warnings import warn
       
    26 from contextlib import contextmanager
    25 from contextlib import contextmanager
    27 from logging import getLogger
    26 from logging import getLogger
    28 
    27 
    29 from six import text_type
    28 from six import text_type
    30 
    29 
   674         rset = self._execute(self, rql, kwargs, build_descr)
   673         rset = self._execute(self, rql, kwargs, build_descr)
   675         rset.req = self
   674         rset.req = self
   676         return rset
   675         return rset
   677 
   676 
   678     @_open_only
   677     @_open_only
   679     def rollback(self, free_cnxset=None, reset_pool=None):
   678     def rollback(self):
   680         """rollback the current transaction"""
   679         """rollback the current transaction"""
   681         if free_cnxset is not None:
       
   682             warn('[3.21] free_cnxset is now unneeded',
       
   683                  DeprecationWarning, stacklevel=2)
       
   684         if reset_pool is not None:
       
   685             warn('[3.13] reset_pool is now unneeded',
       
   686                  DeprecationWarning, stacklevel=2)
       
   687         cnxset = self.cnxset
   680         cnxset = self.cnxset
   688         assert cnxset is not None
   681         assert cnxset is not None
   689         try:
   682         try:
   690             # by default, operations are executed with security turned off
   683             # by default, operations are executed with security turned off
   691             with self.security_enabled(False, False):
   684             with self.security_enabled(False, False):
   700                 self.debug('rollback for transaction %s done', self)
   693                 self.debug('rollback for transaction %s done', self)
   701         finally:
   694         finally:
   702             self.clear()
   695             self.clear()
   703 
   696 
   704     @_open_only
   697     @_open_only
   705     def commit(self, free_cnxset=None, reset_pool=None):
   698     def commit(self):
   706         """commit the current session's transaction"""
   699         """commit the current session's transaction"""
   707         if free_cnxset is not None:
       
   708             warn('[3.21] free_cnxset is now unneeded',
       
   709                  DeprecationWarning, stacklevel=2)
       
   710         if reset_pool is not None:
       
   711             warn('[3.13] reset_pool is now unneeded',
       
   712                  DeprecationWarning, stacklevel=2)
       
   713         assert self.cnxset is not None
   700         assert self.cnxset is not None
   714         cstate = self.commit_state
   701         cstate = self.commit_state
   715         if cstate == 'uncommitable':
   702         if cstate == 'uncommitable':
   716             raise QueryError('transaction must be rolled back')
   703             raise QueryError('transaction must be rolled back')
   717         if cstate == 'precommit':
   704         if cstate == 'precommit':