[Grok-dev] Re: we need a MethodGrokker

Martijn Faassen faassen at startifact.com
Thu May 22 08:33:51 EDT 2008


Philipp von Weitershausen wrote:
> I have introduced a MethodGrokker base class on a grok branch called 
> 'philikon-methodgrokker' (the MethodGrokker base class will obviously 
> move into Martian before the merging happens).

Cool!

> All tests pass except those that check whether permissions used in the 
> following way exist:
> 
>   class MyXMLRPC(grok.XMLRPC):
>       grok.require('doesnt.exist')
> 
>       # otherwise empty class
> 
> With the new MethodGrokker, this won't generate an exception because the 
> referenced permission is never actually applied to any method (because 
> the class is empty).
> 
> The question is: Do we want to keep raising an error in this case, or 
> shall we go the "easy" (and actually cleaner) way of not doing anything? 
> Note that an empty XMLRPC class doesn't do anything anyway (which is 
> probably more worth of an error than anything else).

If it's just this case, I wouldn't mind not doing anything, though 
strictly we'd like all grok.require() statements to be checked...

So I'm inclined to do what you suggest: I think we could make a 
MethodGrokker raise an error if no methods are found. This is always a 
mistake as far as I can see, after all. We should only do this if 
methods might not be incoming from a base class, and I think it should 
be done during Grok time, but I think this could be done, right?

Regards,

Martijn



More information about the Grok-dev mailing list