[Grok-dev] Re: RFC: Making the automatic registration of templates more explicit

Philipp von Weitershausen philipp at weitershausen.de
Wed Jan 31 15:40:10 EST 2007


Jan-Wijbrand Kolman wrote:
>> The advance of the method JW proposed would be that you can *see* which
>> templates are in play by just looking at the Python code.
> 
> And actually, the more I think about it, the more I see it as an
> important advantage! But see my remark later on.

The more I'm thinking about this, the more I tend to agree. Empty 
classes still feel like dead chickens to me, but I also appreciate the 
explicitness.

>> The drawback
>> of the current method, and grok.autotemplates, is that you still don't
>> know which templates are really in play unless you go look at a
>> directory and compare it with the Python file and think hard which
>> templates are there which are not represented by Python.
>>
>> The nice thing about grok.autotemplates() is that we would turn this
>> *off* by default. The alternative JW proposes would be to turn this off
>> entirely and only allow explicit template references, with a slightly
>> shorter spelling.
> 
> We can allow for both mechanisms(?) Just like with the form fields:
> you define them yourself explicitly, or you use some automatic thingy
> to set them up for you.

I would prefer to keep the number of ways how to do something small. For 
something simple as getting templates to publish, there should 
preferrably only be one or two ways. As said, as I'm thinking about it 
mroe and more, I think I could make peace with just one way (explicit 
classes for every view).

>> Does this mean JW that you think the automatic
>> association is something you'd never want?
> 
> Not sure. I know that I would not mind having to declare multiple
> templates in my module. And I do think I would not have the tendency
> to wrap it up in a function only to end up with an
> grok.autotemplates() equivalent.

I think I and others would be tempted by it. The good news is that it 
might not be that much of a problem if we did experiment with it outside 
of grok...

> In other words: if there never had been any automatic association of
> templates, I would not have missed it. I personally like explicit
> declarations, and grok makes these declarations short and easy.


-- 
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5


More information about the Grok-dev mailing list