# HG changeset patch # User Sylvain Thénault # Date 1248857010 -7200 # Node ID 81c8b5312f9c5796c156f7f5be8976b32f068ced # Parent 200985d3258de71afb1c9ed6797cfa4931d7370b move test on force-html-content-type to xhtml_browser method diff -r 200985d3258d -r 81c8b5312f9c view.py --- a/view.py Tue Jul 28 22:22:08 2009 +0200 +++ b/view.py Wed Jul 29 10:43:30 2009 +0200 @@ -403,7 +403,7 @@ @property def doctype(self): - if not self.config['force-html-content-type'] and self.req.xhtml_browser(): + if self.req.xhtml_browser(): return STRICT_DOCTYPE return STRICT_DOCTYPE_NOEXT diff -r 200985d3258d -r 81c8b5312f9c web/request.py --- a/web/request.py Tue Jul 28 22:22:08 2009 +0200 +++ b/web/request.py Wed Jul 29 10:43:30 2009 +0200 @@ -699,6 +699,14 @@ return useragent and 'MSIE' in useragent def xhtml_browser(self): + """return True if the browser is considered as xhtml compatible. + + If the instance is configured to always return text/html and not + application/xhtml+xml, this method will always return False, even though + this is semantically different + """ + if self.vreg.config['force-html-content-type']: + return False useragent = self.useragent() # * MSIE/Konqueror does not support xml content-type # * Opera supports xhtml and handles namespaces properly but it breaks @@ -709,7 +717,7 @@ return True def html_content_type(self): - if not self.vreg.config['force-html-content-type'] and self.xhtml_browser(): + if self.xhtml_browser(): return 'application/xhtml+xml' return 'text/html'