[Grok-dev] proposal: splitting up View from PythonView

Martijn Faassen faassen at startifact.com
Tue Sep 16 09:39:26 EDT 2008


Hi there,

Some refinements to the proposal based on feedback and some more thinking:

* naming concerns: I think 'grok.CodeView' would be the best name I've 
thought of yet.

* We can make 'grok.CodeView' still use the update/render pattern, and 
actually I believe it will be more close than currently in Grok to the 
way it's used in viewlets, which is a win.

* 'grok.View' would subclass from grok.CodeView and would implement 
'render' so that it uses the template.

* Perhaps this means that 'render' can be overridden by grok.View 
subclasses much as it is now, but we just refactor the way views work? 
If we go this route, the use of a custom 'render' in a base class would 
mean no more templates are used in subclasses.

* I believe we now check for the existence of 'render' in __call__ and 
then call it if it's there. Instead I'd propose we always call it from 
__call__ and let it implement the template rendering logic.

I wonder what a refactored grokcore.view looks like that does the above. 
I think a minor shuffling about of what's in __call__ and the creation 
of a 'render' on a base class might go a long way.

Regards,

Martijn



More information about the Grok-dev mailing list