web/request.py
branchstable
changeset 3094 978ed8c2c0e4
parent 2650 18aec79ec3a3
child 3163 edfe43ceaa35
child 3275 5247789df541
equal deleted inserted replaced
3093:12a69f7f963b 3094:978ed8c2c0e4
    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
    29 from cubicweb.view import STRICT_DOCTYPE
    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()
    34 
    34 
   661         """If the HTTP header If-modified-since is set, return the equivalent
   661         """If the HTTP header If-modified-since is set, return the equivalent
   662         mx date time value (GMT), else return None
   662         mx date time value (GMT), else return None
   663         """
   663         """
   664         raise NotImplementedError()
   664         raise NotImplementedError()
   665 
   665 
       
   666     def demote_to_html(self):
       
   667         """helper method to dynamically set request content type to text/html
       
   668 
       
   669         The global doctype and xmldec must also be changed otherwise the browser
       
   670         will display '<[' at the beginning of the page
       
   671         """
       
   672         self.set_content_type('text/html')
       
   673         self.main_stream.doctype = TRANSITIONAL_DOCTYPE_NOEXT
       
   674         self.main_stream.xmldecl = u''
       
   675 
   666     # page data management ####################################################
   676     # page data management ####################################################
   667 
   677 
   668     def get_page_data(self, key, default=None):
   678     def get_page_data(self, key, default=None):
   669         """return value associated to `key` in curernt page data"""
   679         """return value associated to `key` in curernt page data"""
   670         page_data = self.cnx.get_session_data(self.pageid, {})
   680         page_data = self.cnx.get_session_data(self.pageid, {})