[Zope-CMF] Some views don't set the content-type

Charlie Clark charlie.clark at clark-consulting.eu
Tue Apr 6 10:11:28 EDT 2010


Am 05.04.2010, 19:17 Uhr, schrieb Tres Seaver <tseaver at palladion.com>:

> For a template, the <meta> tag should be correct, if present.  No
> template cxcept for the main_template is likely ever to return that tag
> to the browser, but there is no reason we shouldn't believe it when
> loading the template as software.  I wouldn't require *any* template
> outside the main_template to set the DOCTYPE:  the potential for bugs in
> how ZPT (or chameleon) merge the "prefixes" of the documents is too high.

You're right, of course, that this should only affect main_template -  
there can only be one content type per view. I've narrowed the CMF issue  
down to ursa_globals + Firefox. Without a meta tag the content-type gets  
set to "; Charset=utf-8" whereas getMainGlobals sets "text/html;  
Charset=utf-8" in there.

getMainGlobals:
if not 'charset' in (context.REQUEST.RESPONSE.getHeader('content-type') or  
'')
...

context.REQUEST.RESPONSE.setHeader('content-type',
                                     'text/html; charset=%s' %  
default_charset)

ursa_globals
ct = self.request.RESPONSE.getHeader('content-type') or ''
...
self.request.RESPONSE.setHeader('content-type',
                               '%s; charset=%s' % (ct, default_charset))

So getMainGlobals defaults to "text/html" and ursa_globals to " " for the  
content type. I think ursa_globals is wrong here.

Charlie
-- 
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226


More information about the Zope-CMF mailing list