[Grok-dev] Re: first thoughts on "regebro-guido-templates"

Lennart Regebro regebro at gmail.com
Tue Oct 30 09:48:07 EDT 2007

On 10/29/07, Lennart Regebro <regebro at gmail.com> wrote:
> Sure. Today inline templates take typically just one parameter, the
> html, while file templates take two, the filename and the prefix.
> We'd have to make the single class take all three and also make them
> keyword parameters.
> I suggest we standardize on
>     def __init__(html, file=None, prefix=None):
> Since the file instances are initiated from the template registration
> class which is unique per template class, it's not actually necessary
> to have a standard, but I think it would be good for clarity.

In fact, I misremembered slightly. What I did in the Genshi-case is
that I let the Genshi file based templates directly implement the
ITemplateFileFactory interface, to get rid of the separate class
unique per template.

However, merging the file and inline templates would either mean that
we have to change the interface for the ITemplateFileFactory to allow
for html as an init parameter, or separate the TemplateFile and the
TemplateFile factory (which then offsets the benefit of merging the
file template and the inline template, and then we pretty much haven't
achieved anything.

Having the html parameter in the call for a  for a template file
factory also seems silly. We need a better solution for this. Until
that, I'm -1 for merging the inline and template classes.

Lennart Regebro: Zope and Plone consulting.
+33 661 58 14 64

More information about the Grok-dev mailing list