[Grok-dev] Re: ClassGrokkers and component_class and component base
	classes
    Philipp von Weitershausen 
    philipp at weitershausen.de
       
    Tue Feb  6 11:11:30 EST 2007
    
    
  
Jan-Wijbrand Kolman wrote:
> grok.meta.ViewGrokker looks out for classes that subclass grok.View.
> However, the grok.View class itself "subclasses" grok.View as well
> (according to issubclass()) and thus grok.View is actually grokked
> (and some view is registered, but for what?).
I would be surprised if the 'grok.components' module was grokked. If it 
actually is being grokked, I would say it shouldn't.
> The fact that grok component base classes are grokked as well hit me
> when I tried to implement my own grokker for my own type of component:
> 
> component.py:
> 
>  class MyComponent(object):
>    pass
> 
> meta.py:
> 
>  MyComponentGrokker(grok.ClassGrokker):
>    component_class = MyComponent
> 
>    def register(self, context, name, factory, module_info, templates):
>      ...
> 
> where the MyComponent class itself is just a base class for the actual
> component implementations in my application.
> 
> (I wonder if I still make sense...)
> 
> Can we somehow prevent the component base classes from being grokked?
In general I think it'd be useful to be able to tell grok "don't grok 
this thing". There is undocumented behaviour in the GrokkerRegistry that 
makes sure classes whose names end in "Base" aren't grokked, but I think 
something more powerful is necessary.
-- 
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5
    
    
More information about the Grok-dev
mailing list