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

Philipp von Weitershausen philipp at weitershausen.de
Tue Jan 30 12:36:17 EST 2007


We've recently had a discussion about the automatic association of 
templates with models. There are people who think that it bares too much 
magic and should be done more explicitly.

Martijn and others suggested that each fielsystem template would need a 
view class to go with it, hence making the existence of a view class the 
configuration knob for filesystem templates. While appreciating the 
explicitness of this approach, I think that will produce a lot of dead 
chickens if you have a lot of templates to publish.

In an IRC discussion with Martijn just now, I suggested that

* by default, filesystem templates would NOT be grokked automatically. 
They will, however, be grokked when there's an accompanying view class.

* you can put a `grok.autotemplates()` statement into your module that 
will explicitly enable the automatic registration of templates *for that 
module*. Having this statement there, the currently implemented 
behaviour is carried out.

With this in place, grok would only do the automation when it's 
explicitly told to do so. I think a one-liner directive is a decent 
compromise between explicitness and DRY. What do you guys think?


-- 
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