[Grok-dev] grok.template() and inheritance, Was: trying to inherit grok.template

Jan-Wijbrand Kolman janwijbrand at gmail.com
Tue Aug 5 10:14:21 EDT 2008


Somewhere in June Ivo wrote:

> I'm confused by how grok.template() works with inheritance. What I
> want is a baseclass that implements a generic way to list objects in a
> container with an associated template. Specific context
> implementations should derive from this and reuse the template that's
> bound to the base listing.
> This works with render(), but it doesn't work with a template that's
> bound through grok.template() on the baseclass - grok will complain
> there's no associated template or render method.
> I know grok.AddForm does something similar - what's the trick?

Strange thing is, I remember reading this post at that time, but I 
somehow didn't appreciate the issue raised to its full extent.

I do now.

I think this really is a problem, as the behaviour for the 
`grok.template()` directive is counter intuitive *and* different from 
the behaviour of other directives such as `grok.context()` when 
subclassing view components.

My proposal would be that `grok.template()` inheritance behaviour is 
fixed. I'll create a bug report in launchpad. I also volunteer to fix 
the problem - if we indeed agree this is an issue.

So, is this indeed a bug in your opinion?


More information about the Grok-dev mailing list