server/session.py
changeset 6401 d7f5d873e1b8
parent 6147 95c604ec89bf
parent 6385 9f91d09ee5fa
child 6427 c8a5ac2d1eaa
equal deleted inserted replaced
6400:21468682f688 6401:d7f5d873e1b8
    29 
    29 
    30 from logilab.common.deprecation import deprecated
    30 from logilab.common.deprecation import deprecated
    31 from rql.nodes import ETYPE_PYOBJ_MAP, etype_from_pyobj
    31 from rql.nodes import ETYPE_PYOBJ_MAP, etype_from_pyobj
    32 from yams import BASE_TYPES
    32 from yams import BASE_TYPES
    33 
    33 
    34 from cubicweb import Binary, UnknownEid, schema
    34 from cubicweb import Binary, UnknownEid, QueryError, schema
    35 from cubicweb.req import RequestSessionBase
    35 from cubicweb.req import RequestSessionBase
    36 from cubicweb.dbapi import ConnectionProperties
    36 from cubicweb.dbapi import ConnectionProperties
    37 from cubicweb.utils import make_uid, RepeatList
    37 from cubicweb.utils import make_uid, RepeatList
    38 from cubicweb.rqlrewrite import RQLRewriter
    38 from cubicweb.rqlrewrite import RQLRewriter
    39 
    39 
   736             assert not self.pending_operations
   736             assert not self.pending_operations
   737             self._clear_thread_data()
   737             self._clear_thread_data()
   738             self._touch()
   738             self._touch()
   739             self.debug('commit session %s done (no db activity)', self.id)
   739             self.debug('commit session %s done (no db activity)', self.id)
   740             return
   740             return
   741         if self.commit_state:
   741         cstate = self.commit_state
       
   742         if cstate == 'uncommitable':
       
   743             raise QueryError('transaction must be rollbacked')
       
   744         if cstate is not None:
   742             return
   745             return
   743         # on rollback, an operation should have the following state
   746         # on rollback, an operation should have the following state
   744         # information:
   747         # information:
   745         # - processed by the precommit/commit event or not
   748         # - processed by the precommit/commit event or not
   746         # - if processed, is it the failed operation
   749         # - if processed, is it the failed operation