web/request.py
branchstable
changeset 3816 37b376bb4088
parent 3275 5247789df541
child 3838 9cc134372bf8
equal deleted inserted replaced
3814:a4659adf4eee 3816:37b376bb4088
    23 from logilab.mtconverter import xml_escape
    23 from logilab.mtconverter import xml_escape
    24 
    24 
    25 from cubicweb.dbapi import DBAPIRequest
    25 from cubicweb.dbapi import DBAPIRequest
    26 from cubicweb.common.mail import header
    26 from cubicweb.common.mail import header
    27 from cubicweb.common.uilib import remove_html_tags
    27 from cubicweb.common.uilib import remove_html_tags
    28 from cubicweb.utils import SizeConstrainedList, HTMLHead
    28 from cubicweb.utils import SizeConstrainedList, HTMLHead, make_uid
    29 from cubicweb.view import STRICT_DOCTYPE, TRANSITIONAL_DOCTYPE_NOEXT
    29 from cubicweb.view import STRICT_DOCTYPE, TRANSITIONAL_DOCTYPE_NOEXT
    30 from cubicweb.web import (INTERNAL_FIELD_VALUE, LOGGER, NothingToEdit,
    30 from cubicweb.web import (INTERNAL_FIELD_VALUE, LOGGER, NothingToEdit,
    31                           RequestError, StatusResponse)
    31                           RequestError, StatusResponse)
    32 
    32 
    33 _MARKER = object()
    33 _MARKER = object()
    81         # to create a relation with another)
    81         # to create a relation with another)
    82         self.search_state = ('normal',)
    82         self.search_state = ('normal',)
    83         # tabindex generator
    83         # tabindex generator
    84         self.tabindexgen = count(1)
    84         self.tabindexgen = count(1)
    85         self.next_tabindex = self.tabindexgen.next
    85         self.next_tabindex = self.tabindexgen.next
    86         # page id, set by htmlheader template
       
    87         self.pageid = None
       
    88         self.varmaker = rqlvar_maker()
    86         self.varmaker = rqlvar_maker()
    89         self.datadir_url = self._datadir_url()
    87         self.datadir_url = self._datadir_url()
       
    88         self._set_pageid()
       
    89 
       
    90     def _set_pageid(self):
       
    91         """initialize self.pageid
       
    92         if req.form provides a specific pageid, use it, otherwise build a
       
    93         new one.
       
    94         """
       
    95         pid = self.form.get('pageid')
       
    96         if pid is None:
       
    97             pid = make_uid(id(self))
       
    98         self.pageid = pid
       
    99         self.html_headers.define_var('pageid', pid)
    90 
   100 
    91     def set_connection(self, cnx, user=None):
   101     def set_connection(self, cnx, user=None):
    92         """method called by the session handler when the user is authenticated
   102         """method called by the session handler when the user is authenticated
    93         or an anonymous connection is open
   103         or an anonymous connection is open
    94         """
   104         """