[Grok-dev] Bug in JSON view?

Martijn Faassen faassen at startifact.com
Wed Jan 14 05:15:55 EST 2009


Hey,

Sebastian Wiemer wrote:
> is this a bug in grok.JSON?
> 
> I wrote a class and a JSONAdapter for that class.
> But the function "delete(self, key)" does not work, because
> the last to letters of the string value of "key" is somehow  
> "overwritten" with the letters "Pr".
> So the key 1234abc yields 1234aPr

Mysterious!

What is calling deleteItem? I assume you're not calling it directly 
through the web, correct? As to get request variables I was not aware 
that you could use parameters like that with JSON, instead you would 
look in the request.form dictionary here.

Note that methods on grok.JSON subclasses all become JSON views, which 
you may not want for deleteItem. You could prefix your method with '_' 
to make it private and non-published.

I think that publishing all methods is perhaps counterintuitive, so 
perhaps we need to look at a decorator-driven approach to publishing 
JSON and XMLRPC methods instead (I think publishing REST methods is all 
right though for grok.REST).

Regards,

Martijn



More information about the Grok-dev mailing list