[Grok-dev] Re: RFC: Making the automatic registration of templates
more explicit
Martijn Faassen
faassen at startifact.com
Sat Feb 3 14:35:39 EST 2007
Philipp von Weitershausen 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
>
> Having to delete stuff to evolve sucks. I'd rather have empty classes,
> even if they look dead-chicken-y:
>
> class Index(grok.View):
> pass # rendered by a template
>
We could have a grok.PageTemplateFile that acts entirely like
grok.PageTemplate. As far as I recall that will be auto-associated if no
view exists, but otherwise it'll be hooked up to the view. This is a
good argument for symmetry with grok.PageTemplate.
[snip]
>> we need to come up with a module-level
>> grok.view(class=, template=, ...) registration?
>
> Shrug. Please, no. We're bringing back ZCML all over again, only in a
> different wrapper. Less is more. One class and one template per view is
> absolutely ok; if there's a need for consolidating commonly used stuff,
> there's always subclassing. Let people use this "natural" way of
> consolidating things. They don't need to learn extra stuff.
Shrug or please no? :)
I agree with Philipp in that we should be very careful about introducing
new directives here. I agree that subclassing is a reuse mechanism that
we should explore first.
Regards,
Martijn
More information about the Grok-dev
mailing list