[Grok-dev] Re: what grok.JSON methods to publish?

Martijn Faassen faassen at startifact.com
Fri Jan 4 12:59:37 EST 2008


Jan-Jaap Driessen wrote:
> Some details where lost in writing my last email:
> 
>  > The __*__ methods of grok.JSON classes are registered as views.
> 
> A solution, similar to RESTGrokker and XMLRPCGrokker, is to ignore names 
> with leading double underscores.
> 
> The RESTGrokker and XMLRPCGrokker have the following comment:
> 
>   # XXX We should really not make __FOO__ methods available to
>   # the outside -- need to discuss how to restrict such things.
> 
> Is the solution suggested by Brandon applicable for REST and XMLRPC?

XMLRPC definitely. REST is a bit different, but could be; I'd need to 
study the code again. If I left that comment in there there's a decent 
chance it is.

I think indeed the default behavior should be disallow at least double 
underscores. Forbidding single underscores I'd also be fine with. 
Finally I think it's also a good idea to have decorators to explicitly 
publish or unpublish views. These would only be useful in classes that 
publish methods directly (XMLRPC, JSON and probably REST).

It'd be useful to have a function somewhere in Grok that applied the 
rules so we can reuse this whenever needed.

Regards,

Martijn



More information about the Grok-dev mailing list