# HG changeset patch # User Aurelien Campeas # Date 1242642780 -7200 # Node ID d4cbcc15c01ccf81b630ce0963e436ba86e1a10a # Parent 67fcc174d2992bb980869f966457fc62a1c41a90 work-around for #343301 (display garbage in non xhtml browsers) diff -r 67fcc174d299 -r d4cbcc15c01c web/views/basecontrollers.py --- a/web/views/basecontrollers.py Mon May 18 11:56:03 2009 +0200 +++ b/web/views/basecontrollers.py Mon May 18 12:33:00 2009 +0200 @@ -18,7 +18,7 @@ from cubicweb import NoSelectableObject, ValidationError, ObjectNotFound, typed_eid from cubicweb.utils import strptime from cubicweb.selectors import yes, match_user_groups -from cubicweb.view import STRICT_DOCTYPE +from cubicweb.view import STRICT_DOCTYPE, STRICT_DOCTYPE_NOEXT from cubicweb.common.mail import format_mail from cubicweb.web import ExplicitLogin, Redirect, RemoteCallFailed, json_dumps from cubicweb.web.formrenderers import FormRenderer @@ -32,8 +32,12 @@ HAS_SEARCH_RESTRICTION = False -def xhtml_wrap(source): - head = u'\n' + STRICT_DOCTYPE +def xhtml_wrap(self, source): + # XXX factor out, watch view.py ~ Maintemplate.doctype + if self.req.xhtml_browser(): + dt = STRICT_DOCTYPE + dt = STRICT_DOCTYPE_NOEXT + head = u'\n' + dt return head + u'
%s
' % source.strip() def jsonize(func): @@ -51,7 +55,7 @@ def wrapper(self, *args, **kwargs): self.req.set_content_type(self.req.html_content_type()) result = func(self, *args, **kwargs) - return xhtml_wrap(result) + return xhtml_wrap(self, result) wrapper.__name__ = func.__name__ return wrapper