req.py
branchstable
changeset 5290 15846058378b
parent 5199 ebb50479d2ab
child 5302 dfd147de06b2
child 5421 8167de96c523
equal deleted inserted replaced
5289:540fa73caac6 5290:15846058378b
    41 class RequestSessionBase(object):
    41 class RequestSessionBase(object):
    42     """base class containing stuff shared by server session and web request
    42     """base class containing stuff shared by server session and web request
    43 
    43 
    44     request/session is the main resources accessor, mainly through it's vreg
    44     request/session is the main resources accessor, mainly through it's vreg
    45     attribute:
    45     attribute:
    46     :vreg:
    46 
    47       the instance's registry
    47     :attribute vreg: the instance's registry
    48     :vreg.schema:
    48     :attribute vreg.schema: the instance's schema
    49       the instance's schema
    49     :attribute vreg.config: the instance's configuration
    50     :vreg.config:
       
    51       the instance's configuration
       
    52     """
    50     """
    53     def __init__(self, vreg):
    51     def __init__(self, vreg):
    54         self.vreg = vreg
    52         self.vreg = vreg
    55         try:
    53         try:
    56             encoding = vreg.property_value('ui.encoding')
    54             encoding = vreg.property_value('ui.encoding')
   138         first = rql.split(' ', 1)[0].lower()
   136         first = rql.split(' ', 1)[0].lower()
   139         if first in ('insert', 'set', 'delete'):
   137         if first in ('insert', 'set', 'delete'):
   140             raise Unauthorized(self._('only select queries are authorized'))
   138             raise Unauthorized(self._('only select queries are authorized'))
   141 
   139 
   142     def get_cache(self, cachename):
   140     def get_cache(self, cachename):
   143         """
   141         """cachename should be dotted names as in :
   144         NOTE: cachename should be dotted names as in :
   142 
   145         - cubicweb.mycache
   143         - cubicweb.mycache
   146         - cubes.blog.mycache
   144         - cubes.blog.mycache
   147         - etc.
   145         - etc.
   148         """
   146         """
   149         if cachename in CACHE_REGISTRY:
   147         if cachename in CACHE_REGISTRY: