server/session.py
changeset 2891 60afb9705035
parent 2880 bfc8e1831290
child 2968 0e3460341023
equal deleted inserted replaced
2890:fdcb8a2bb6eb 2891:60afb9705035
   598         self.is_internal_session = False
   598         self.is_internal_session = False
   599         self.is_super_session = True
   599         self.is_super_session = True
   600         # session which has created this one
   600         # session which has created this one
   601         self.parent_session = parent_session
   601         self.parent_session = parent_session
   602         self.user = InternalManager()
   602         self.user = InternalManager()
       
   603         self.user.req = self # XXX remove when "vreg = user.req.vreg" hack in entity.py is gone
   603         self.repo = parent_session.repo
   604         self.repo = parent_session.repo
   604         self.vreg = parent_session.vreg
   605         self.vreg = parent_session.vreg
   605         self.data = parent_session.data
   606         self.data = parent_session.data
   606         self.encoding = parent_session.encoding
   607         self.encoding = parent_session.encoding
   607         self.lang = parent_session.lang
   608         self.lang = parent_session.lang
   667 
   668 
   668 class InternalSession(Session):
   669 class InternalSession(Session):
   669     """special session created internaly by the repository"""
   670     """special session created internaly by the repository"""
   670 
   671 
   671     def __init__(self, repo, cnxprops=None):
   672     def __init__(self, repo, cnxprops=None):
   672         super(InternalSession, self).__init__(_IMANAGER, repo, cnxprops,
   673         super(InternalSession, self).__init__(InternalManager(), repo, cnxprops,
   673                                               _id='internal')
   674                                               _id='internal')
       
   675         self.user.req = self # XXX remove when "vreg = user.req.vreg" hack in entity.py is gone
   674         self.cnxtype = 'inmemory'
   676         self.cnxtype = 'inmemory'
   675         self.is_internal_session = True
   677         self.is_internal_session = True
   676         self.is_super_session = True
   678         self.is_super_session = True
   677 
   679 
   678     @property
   680     @property
   705     def property_value(self, key):
   707     def property_value(self, key):
   706         if key == 'ui.language':
   708         if key == 'ui.language':
   707             return 'en'
   709             return 'en'
   708         return None
   710         return None
   709 
   711 
   710 _IMANAGER = InternalManager()
       
   711 
   712 
   712 from logging import getLogger
   713 from logging import getLogger
   713 from cubicweb import set_log_methods
   714 from cubicweb import set_log_methods
   714 set_log_methods(Session, getLogger('cubicweb.session'))
   715 set_log_methods(Session, getLogger('cubicweb.session'))