server/session.py
changeset 9468 39b7a91a3f4c
parent 9466 c3a5f4507f12
child 9469 032825bbacab
equal deleted inserted replaced
9467:ad66d7b3fd48 9468:39b7a91a3f4c
     1 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
    29 
    29 
    30 from logilab.common.deprecation import deprecated
    30 from logilab.common.deprecation import deprecated
    31 from logilab.common.textutils import unormalize
    31 from logilab.common.textutils import unormalize
    32 from logilab.common.registry import objectify_predicate
    32 from logilab.common.registry import objectify_predicate
    33 
    33 
    34 from cubicweb import UnknownEid, QueryError, schema, server, ProgrammingError
    34 from cubicweb import QueryError, schema, server, ProgrammingError
    35 from cubicweb.req import RequestSessionBase
    35 from cubicweb.req import RequestSessionBase
    36 from cubicweb.utils import make_uid
    36 from cubicweb.utils import make_uid
    37 from cubicweb.rqlrewrite import RQLRewriter
    37 from cubicweb.rqlrewrite import RQLRewriter
    38 from cubicweb.server import ShuttingDown
    38 from cubicweb.server import ShuttingDown
    39 from cubicweb.server.edition import EditedEntity
    39 from cubicweb.server.edition import EditedEntity
   158 
   158 
   159 
   159 
   160     def __init__(self, session, mode, *categories):
   160     def __init__(self, session, mode, *categories):
   161         self.session = session
   161         self.session = session
   162         super_init = super(_session_hooks_control, self).__init__
   162         super_init = super(_session_hooks_control, self).__init__
   163         return super_init(session._cnx, mode, *categories)
   163         super_init(session._cnx, mode, *categories)
   164 
   164 
   165     def __exit__(self, exctype, exc, traceback):
   165     def __exit__(self, exctype, exc, traceback):
   166         super_exit = super(_session_hooks_control, self).__exit__
   166         super_exit = super(_session_hooks_control, self).__exit__
   167         ret = super_exit(exctype, exc, traceback)
   167         ret = super_exit(exctype, exc, traceback)
   168         if self.cnx.ctx_count == 0:
   168         if self.cnx.ctx_count == 0:
   213 
   213 
   214 
   214 
   215     def __init__(self, session, read=None, write=None):
   215     def __init__(self, session, read=None, write=None):
   216         self.session = session
   216         self.session = session
   217         super_init = super(_session_security_enabled, self).__init__
   217         super_init = super(_session_security_enabled, self).__init__
   218         return super_init(session._cnx, read=read, write=write)
   218         super_init(session._cnx, read=read, write=write)
   219 
   219 
   220     def __exit__(self, exctype, exc, traceback):
   220     def __exit__(self, exctype, exc, traceback):
   221         super_exit = super(_session_security_enabled, self).__exit__
   221         super_exit = super(_session_security_enabled, self).__exit__
   222         ret = super_exit(exctype, exc, traceback)
   222         ret = super_exit(exctype, exc, traceback)
   223         if self.cnx.ctx_count == 0:
   223         if self.cnx.ctx_count == 0: