web/request.py
changeset 3163 edfe43ceaa35
parent 2801 7ef4c1c9266b
parent 3094 978ed8c2c0e4
child 3293 69c0ba095536
equal deleted inserted replaced
3090:8184bec7414d 3163:edfe43ceaa35
    25 
    25 
    26 from cubicweb.dbapi import DBAPIRequest
    26 from cubicweb.dbapi import DBAPIRequest
    27 from cubicweb.common.mail import header
    27 from cubicweb.common.mail import header
    28 from cubicweb.common.uilib import remove_html_tags
    28 from cubicweb.common.uilib import remove_html_tags
    29 from cubicweb.utils import SizeConstrainedList, HTMLHead
    29 from cubicweb.utils import SizeConstrainedList, HTMLHead
    30 from cubicweb.view import STRICT_DOCTYPE
    30 from cubicweb.view import STRICT_DOCTYPE, TRANSITIONAL_DOCTYPE_NOEXT
    31 from cubicweb.web import (INTERNAL_FIELD_VALUE, LOGGER, NothingToEdit,
    31 from cubicweb.web import (INTERNAL_FIELD_VALUE, LOGGER, NothingToEdit,
    32                           RequestError, StatusResponse)
    32                           RequestError, StatusResponse)
    33 
    33 
    34 _MARKER = object()
    34 _MARKER = object()
    35 
    35 
   687         """If the HTTP header If-modified-since is set, return the equivalent
   687         """If the HTTP header If-modified-since is set, return the equivalent
   688         mx date time value (GMT), else return None
   688         mx date time value (GMT), else return None
   689         """
   689         """
   690         raise NotImplementedError()
   690         raise NotImplementedError()
   691 
   691 
       
   692     def demote_to_html(self):
       
   693         """helper method to dynamically set request content type to text/html
       
   694 
       
   695         The global doctype and xmldec must also be changed otherwise the browser
       
   696         will display '<[' at the beginning of the page
       
   697         """
       
   698         self.set_content_type('text/html')
       
   699         self.main_stream.doctype = TRANSITIONAL_DOCTYPE_NOEXT
       
   700         self.main_stream.xmldecl = u''
       
   701 
   692     # page data management ####################################################
   702     # page data management ####################################################
   693 
   703 
   694     def get_page_data(self, key, default=None):
   704     def get_page_data(self, key, default=None):
   695         """return value associated to `key` in curernt page data"""
   705         """return value associated to `key` in curernt page data"""
   696         page_data = self.cnx.get_session_data(self.pageid, {})
   706         page_data = self.cnx.get_session_data(self.pageid, {})