[Grok-dev] Why must a CodeView have a render() method?

Jan-Wijbrand Kolman janwijbrand at gmail.com
Sun Jul 12 15:48:02 EDT 2009


Martin Aspeli wrote:
> Hi,
> 
> I often use views that are not browser pages, i.e. they are not meant to 
> be published, but contain utility functions looked up by traversal in 
> other contexts (e.g. conditional expressions).
> 
> I had thought this was one of the use cases for a 
> grokcore.view.CodeView, but I guess not, since it requires a render() 
> method.

I'm sorry, but no, that's not the use case. Its mere existence is to be 
able to have views that not use a template to render content versus 
views that have a template, without the complex, hard to explain 
stratetgy for finding an implicitely or explicitely associated template 
and checking there's no render() in that case that we had before.

> Would it make sense to either relax this requirement, so that a CodeView 
> without a render method can still be looked up but can't be published 
> directly? Or maybe to add some other kind of base class for this use case?

I looked up a thread of quite a while ago where we discussed this before.

Even after re-reading the thread some nuances for such a component are 
not completely clear to me. I would in any way encourage to write a 
megrok.* package to extend Grok with such a component! Eventually this 
component could then go into "core" Grok of course.

regards,
jw



More information about the Grok-dev mailing list