web/request.py
branchstable
changeset 6259 c3d98e4bee12
parent 6108 c459ffa5fa6f
child 6353 b622602f8e9d
equal deleted inserted replaced
6258:9b5c008267b0 6259:c3d98e4bee12
    97         # controller, application...)
    97         # controller, application...)
    98         self.data = {}
    98         self.data = {}
    99         # search state: 'normal' or 'linksearch' (eg searching for an object
    99         # search state: 'normal' or 'linksearch' (eg searching for an object
   100         # to create a relation with another)
   100         # to create a relation with another)
   101         self.search_state = ('normal',)
   101         self.search_state = ('normal',)
   102         # tabindex generator
       
   103         self.tabindexgen = count(1)
       
   104         self.next_tabindex = self.tabindexgen.next
       
   105         # page id, set by htmlheader template
   102         # page id, set by htmlheader template
   106         self.pageid = None
   103         self.pageid = None
   107         self._set_pageid()
   104         self._set_pageid()
   108         # prepare output header
   105         # prepare output header
   109         self.headers_out = Headers()
   106         self.headers_out = Headers()
   128 
   125 
   129         * calling req.set_varmaker() to ensure a varmaker is set for later ajax
   126         * calling req.set_varmaker() to ensure a varmaker is set for later ajax
   130           calls sharing our .pageid
   127           calls sharing our .pageid
   131         """
   128         """
   132         return self.set_varmaker()
   129         return self.set_varmaker()
       
   130 
       
   131     def _get_tabindex_func(self):
       
   132         nextfunc = self.get_page_data('nexttabfunc')
       
   133         if nextfunc is None:
       
   134             nextfunc = count(1).next
       
   135             self.set_page_data('nexttabfunc', nextfunc)
       
   136         return nextfunc
   133 
   137 
   134     def set_varmaker(self):
   138     def set_varmaker(self):
   135         varmaker = self.get_page_data('rql_varmaker')
   139         varmaker = self.get_page_data('rql_varmaker')
   136         if varmaker is None:
   140         if varmaker is None:
   137             varmaker = rqlvar_maker()
   141             varmaker = rqlvar_maker()
   141     def set_session(self, session, user=None):
   145     def set_session(self, session, user=None):
   142         """method called by the session handler when the user is authenticated
   146         """method called by the session handler when the user is authenticated
   143         or an anonymous connection is open
   147         or an anonymous connection is open
   144         """
   148         """
   145         super(CubicWebRequestBase, self).set_session(session, user)
   149         super(CubicWebRequestBase, self).set_session(session, user)
       
   150         # tabindex generator
       
   151         self.next_tabindex = self._get_tabindex_func()
   146         # set request language
   152         # set request language
   147         vreg = self.vreg
   153         vreg = self.vreg
   148         if self.user:
   154         if self.user:
   149             try:
   155             try:
   150                 # 1. user specified language
   156                 # 1. user specified language