[Grok-dev] PageTemplateFile('path/to/template.cpt') does not work anymore

Jan-Wijbrand Kolman janwijbrand at gmail.com
Mon May 7 11:31:25 UTC 2012

On 5/7/12 12:06 , Jan-Wijbrand Kolman wrote:
> On 5/7/12 11:51 , Uli Fouquet wrote:
>> Hi Christian and JW,
>> On Mon, 07 May 2012 11:45:43 +0200 Christian Klinger wrote:
>>> the baseclass is now
>>> ChameleonPageTemplateFile instead of PageTemplateFile
>> Wouldn't it make sense to offer `PageTemplateFile` as a shortcut as well
>> (additionally)?
> I agree. To what extent is the PageTemplate(File) useful in itself?
> In other words, why is there *both* a PageTemplate(File) *and* a
> ChameleonPageTemplate(File).
> I'd rather have just a PageTemplate(File) component. The package is
> enough of a prefix to understand it is a chameleon-based template.

Actually, it getting clearer now:

The ChameleonPageTemplate class (subclassing from GrokTemplate) is the
component that is attached to a view by way of the grok.template()
directive. It is the glue between grok's idea of calling an template
(including injecting extra namespaces etc.) and the concrete template
implementation's rendering.

The ChameleonPageTemplateFile class is new to grokcore.chameleon and,
since it subclasses ChameleonPageTemplate and thus GrokTemplate, tries
to behave like a glue too, making it easier to point to a path relative
to the caller module.

In other words, ChameleonPageTemplateFile seems to be useful after all,
and can be used instead of the template =
ChameleonPageTemplate(filename='asdasdas.cpt') pattern that used to work
on grok view components.

Still I think the ChameleonPageTemplate(File) classes in
grokcore.chameleon.components could have a shorter name. This would mean
the helper PageTemplate(File) helper classes in
grokcore.chalemeon.components should be renamed to indicate there are
not very useful by themselves.

What do you think?

regards, jw

More information about the Grok-dev mailing list