Re: txJSONRPC: issue accesson Session information and returning error

[email protected]
Newsgroups gmane.comp.python.twisted.web
Message-ID <20110128184818.1699.1384194118.divmod.xquotient.388@localhost.localdomain>
On 12:01 am, [email protected] wrote:
>G'day everybody,
>
>I'm using TxJSON-RPC with twisted.web for a project.
>In my JSON-RPC method, I want to access the Request instance to call
>getSession() (I need to identify the user which is calling the method
>with the Session instance), but the request object is not forwarded to
>jsonrpc_xxx methods. I don't see any other way than overidding the
>render method, is there any better way ?

twisted.web.xmlrpc had the same limitation until http://tm.tl/3073 was 
resolved recently.  For that ticket we added a `withRequest` decorator. 
The same solution could most likely be applied to txjsonrpc.

Jean-Paul
>My other issue is that I want to be able to return a jsonrpc error 
>(when
>the user is not identified), and when I send a
>jsonrpclib.Fail(12,"hello") like in the tests, I have a HTML 500 error.
>Any suggestion ?
>
>Thanks
>Goffi
>
>_______________________________________________
>Twisted-web mailing list
>[email protected]
>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.