cubicweb/server/session.py
changeset 12567 26744ad37953
parent 12542 85194bd49119
child 12740 6e98699d3a9a
equal deleted inserted replaced
12566:6b3523f81f42 12567:26744ad37953
    15 #
    15 #
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """Repository users' and internal' sessions."""
    18 """Repository users' and internal' sessions."""
    19 
    19 
    20 from __future__ import print_function
       
    21 
       
    22 import functools
    20 import functools
    23 import sys
    21 import sys
    24 from uuid import uuid4
    22 from uuid import uuid4
    25 from contextlib import contextmanager
    23 from contextlib import contextmanager
    26 from logging import getLogger
    24 from logging import getLogger
    27 
       
    28 from six import text_type
       
    29 
    25 
    30 from logilab.common.registry import objectify_predicate
    26 from logilab.common.registry import objectify_predicate
    31 
    27 
    32 from cubicweb import QueryError, ProgrammingError, schema, server
    28 from cubicweb import QueryError, ProgrammingError, schema, server
    33 from cubicweb import set_log_methods
    29 from cubicweb import set_log_methods
   639 
   635 
   640     @_open_only
   636     @_open_only
   641     def transaction_uuid(self, set=True):
   637     def transaction_uuid(self, set=True):
   642         uuid = self.transaction_data.get('tx_uuid')
   638         uuid = self.transaction_data.get('tx_uuid')
   643         if set and uuid is None:
   639         if set and uuid is None:
   644             self.transaction_data['tx_uuid'] = uuid = text_type(uuid4().hex)
   640             self.transaction_data['tx_uuid'] = uuid = uuid4().hex
   645             self.repo.system_source.start_undoable_transaction(self, uuid)
   641             self.repo.system_source.start_undoable_transaction(self, uuid)
   646         return uuid
   642         return uuid
   647 
   643 
   648     @_open_only
   644     @_open_only
   649     def transaction_inc_action_counter(self):
   645     def transaction_inc_action_counter(self):