[Grok-dev] Re: grok.PageTemplate and content types
Philipp von Weitershausen
philipp at weitershausen.de
Sat Jan 13 08:41:12 EST 2007
On 12 Jan 2007, at 20:35 , Jan-Wijbrand Kolman wrote:
>> Not entirely. I think the initial goal was to explicitly specify
>> 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.
Right. It should probably suggest that different parsers would be
index = grok.PageTemplate('<p />', parse='xml')
More information about the Grok-dev