[Grok-dev] Re: grok.PageTemplate and content types

Jan-Wijbrand Kolman janwijbrand at gmail.com
Fri Jan 12 05:58:06 EST 2007


(ouch, I replied to Philipp initially, not to the list. Here is it again)

> >> We could make this quite explicit using the file extension, for
> >> example. 'foo.pt' would be text/html and 'foo.xpt' would be text/xml.
> >
> > That's too big of a change;
<snip>

I agree. Actually, I was wondering about the "dependency" on the *.pt
extension altogether. But that's for some other time.

> > Is the sniffing too magic? Do people trip up because of this in Zope?
>
> Well, it used to be that you had to add the <?xml ?> processing
> instruction to a template file to enforce the XML parser. This made it
> pretty much impossible to use the XML parser for XHTML documents because
> IE goes into quirks mode when it sees <?xml ?>.

Ah, good point, I didn't realise that...

> I'm pretty sure that zope.pagetemplate.pagetemplatefile still uses that
> sniffing algorithm.

Yes it is.

What about begin able to do this:

 class Foo(grok.View):
     grok.template('specialfoo', mime_type='application/xml')

and

 grok.PageTemplate("""\
     <html>
     ...
     </html>
     """, mime_type="application/xml")

Would that work? We still need to find a reasonable default of course...


--
Jan-Wijbrand Kolman


More information about the Grok-dev mailing list