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

Martijn Faassen faassen at startifact.com
Sat Feb 3 14:37:59 EST 2007


Philipp von Weitershausen wrote:
> On 3 Feb 2007, at 16:32 , ct at gocept.com wrote:
>>> On 3 Feb 2007, at 16:10 , ct at gocept.com wrote:
>>>> Sorry for catching up so late. I'm trying to remember everything that
>>>> popped up in my mind while reading this thread.
>>>>
>>>> 1. I like grok.template('asdf') on a module level in opposition to
>>>> "consume all templates".
>>>
>>> Ok. The only beef I have with it is that the evolution path to a
>>> template + view isn't very gradual. Say you only have a template,
>>> index.pt. So you do:
>>>
>>>    grok.template('index')
>>>
>>> Now you realize you need to compute some stuff in that template, so
>>> you delete that line again and write:
>>>
>>>    class Index(grok.View):
>>>
>>>        def update(self):
>>>            self.pi = 3
>>
>> Uh. Why? IMHO template() would act the same way as the autotemplates()
>> would. Meaning: the template 'index' would be 'activated' and if a class
>> Index is around then also associated with it.
> 
> I'm confused then. How would you write a class that's associated with a 
> template?
[snip]

The more I see about this discussion, the more I'm convinced that 
something like grok.PageTemplateFile is far clearer than something like 
'grok.template' on module-level.

 >> Hmm. True in a sense. I'm not sure subclassing handles the same
 >> use-cases.
 >
 > I would be surprised if it can't handle them. I think we need to play
 > with this more and actually try solve some usecases out there before
 > we should introduce new concepts and statements.

Agreed - explore this by concrete usecases and seeing what's needed then 
is the way to go.

Regards,

Martijn



More information about the Grok-dev mailing list