cubicweb/server/repository.py
changeset 12043 b8d2e6b9f548
parent 12036 4c2c731f9190
child 12044 70bb46dfa87b
equal deleted inserted replaced
12042:5e64a98572de 12043:b8d2e6b9f548
    45                       UnknownEid, AuthenticationError, ExecutionError,
    45                       UnknownEid, AuthenticationError, ExecutionError,
    46                       UniqueTogetherError, ViolatedConstraint)
    46                       UniqueTogetherError, ViolatedConstraint)
    47 from cubicweb import set_log_methods
    47 from cubicweb import set_log_methods
    48 from cubicweb import cwvreg, schema, server
    48 from cubicweb import cwvreg, schema, server
    49 from cubicweb.server import utils, hook, querier, sources
    49 from cubicweb.server import utils, hook, querier, sources
    50 from cubicweb.server.session import Session, InternalManager
    50 from cubicweb.server.session import InternalManager, Connection
    51 
    51 
    52 
    52 
    53 NO_CACHE_RELATIONS = set([
    53 NO_CACHE_RELATIONS = set([
    54     ('owned_by', 'object'),
    54     ('owned_by', 'object'),
    55     ('created_by', 'object'),
    55     ('created_by', 'object'),
   665         """Context manager returning a Connection using internal user which have
   665         """Context manager returning a Connection using internal user which have
   666         every access rights on the repository.
   666         every access rights on the repository.
   667 
   667 
   668         Internal connections have all hooks beside security enabled.
   668         Internal connections have all hooks beside security enabled.
   669         """
   669         """
   670         with Session(InternalManager(), self).new_cnx() as cnx:
   670         with Connection(self, InternalManager()) as cnx:
   671             cnx.user._cw = cnx  # XXX remove when "vreg = user._cw.vreg" hack in entity.py is gone
   671             cnx.user._cw = cnx  # XXX remove when "vreg = user._cw.vreg" hack in entity.py is gone
   672             with cnx.security_enabled(read=False, write=False):
   672             with cnx.security_enabled(read=False, write=False):
   673                 yield cnx
   673                 yield cnx
   674 
   674 
   675     # data sources handling ###################################################
   675     # data sources handling ###################################################