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

Martijn Faassen faassen at startifact.com
Mon Sep 15 08:34:41 EDT 2008


Hi there,

In the discussion with template assocation I realized that the magic 
rule that views currently have concerning 'render' and template 
association is perhaps a bit too magic.

It seems reasonable to split up these responsibilities. 'grok.View' 
would remain our normal template-associated view. 'grok.PythonView' 
(better name possible?) would become the view with the 'render' method, 
which we might decide to rewrite to '__call__' instead of 'render'. We 
can then make grok.View be a subclass of grok.PythonView, which 
implements the template association.

It would break backwards compatibility, but not in a very complicated 
way. The ViewGrokker could look for render methods and issue an error 
message when it finds one, at least initially. The thing the developer 
will then have to do is rename render to __call__, and grok.View to 
grok.PythonView, a shallow operation.

What do people think?

Regards,

Martijn



More information about the Grok-dev mailing list