[Grok-dev] Using z3c.jsonrpc with grok and ForbiddenAttribute issues

Tim Terlegård tim.terlegard at valentinewebsystems.se
Sat May 31 06:02:05 EDT 2008


On May 31, 2008, at 6:37 AM, Calvin Hendryx-Parker wrote:

> I'd like to be able to use z3c.jsonrpc with Grok so I can provide  
> JSON-RPC specific methods to some of my models.  I finally got it  
> installed and I have added the needed ZCML to wire it up to my  
> model, but now I'm running into security issues.

As it seemed to be a little complicated to get this running, I'm  
wondering if
you can't use grok.JSON?


> Here is my example, I have a Note class that is a grok.Model and I  
> have put a marker interface on it so I can associate my jsonrpc with  
> it like this:
>
>  <z3c:jsonrpc
>    for=".interfaces.INote"
>    class=".note.NoteJSON"
>    permission="brnf.notes"
>    methods="edit"/>
>
> Now from my GUI app, I'm using MochiKit's JsonRpcProxy to access  
> this "edit" method on my model.

class NoteJSON(grok.JSON):
     grok.context(INote)

     def edit(title='', text=''):
         self.context.title = title
         self.context.text = text

This is what edit could look like. I'm not sure of the difference  
between this and
jsonrpc from your application's perspective.

/Tim


More information about the Grok-dev mailing list