[Grok-dev] Re: grok.PageTemplate and content types
janwijbrand at gmail.com
Fri Jan 12 14:35:02 EST 2007
> Not entirely. I think the initial goal was to explicitly specify which
> parser (HTML or XML) the ZPT engine would use. That was at least JW's
Yes that's correct. I got carried away a bit confusing two issues:
1) the ability to control what parser to use for parsing the template "source".
2) the ability to control the output content type.
For 2) we have request.setHeader('Content-Type'...).
And I quess this is usually related to the type of the template
source, but not necessarily so.
For 1) we need some control, because the 'normal' sniffing of Zope-3
is not used and we might not want to use it at all. That's where
either the file extension for a template file, or passing a parameter
when instantiating a template comes in play.
At first I was not really in favor of the file extension solution.
Martijn suggested that the file extension could actually control what
template system to use. You could argue that the HTMLTALParser is a
different templating engine from the TALParser. Following this line of
thought I would not be against the file extension solution after all.
If we decide not to use the file extension solution, we could go for
passing in a parameter upon instantiation. I'm still not sure whether
this parameter should be called 'content_type' as we try to indicate
the type of the source file, not so much the type of the output.
More information about the Grok-dev