[Grok-dev] Re: "baseclass" or "ignore"?

Jan-Wijbrand Kolman janwijbrand at gmail.com
Thu Oct 25 10:24:57 EDT 2007


Brandon Craig Rhodes wrote:
> While reading template code, it occurred to me that:
> 
>     class MyClass(...):
>         grok.ignore()
> 
> is more readable than:
> 
>     class MyClass(...):
>         grok.baseclass()
> 
> which seems to communicate something one step removed from what the
> directive is really going to do.  I suppose I'm going to receive the
> objection that things are nice the way things are and that if clarity
> were our aim we would have to say: :-)
> 
>     class MyClass(...):
>         grok.dont_grok_this_class_but_still_grok_its_subclasses()

If grok.baseclass() is really only used for not grokking base classes of 
your components, than I'm -1.

There is after all the other Grok convention where if a class name ends 
in 'Base', it is considered a not-to-grok base class:

   class MyComponentBase(grok.....):
       pass # not grokked

   class MyActualComponent(MyComponentBase):
       pass # this is grokkked


If there's actually more use cases where you do not want to grok a 
component, than I'm +0.


regards,
jw



More information about the Grok-dev mailing list