Hi
I am using json rpc to invoke test method of my class but I am getting
the following
error:
KeyError: 'result'\n begin captured logging
\npyramid_rpc.jsonrpc: DEBUG: view callable
function dummy_rpc at 0x1021f0c08 found for method
u'dummy_rpc'\n- end captured logging
-
My test view configuration is:
***
from pyramid.renderers import null_renderer
renderer = null_renderer
from pyramid_rpc.jsonrpc import JsonRpcViewMapper
config.add_route('JSON-RPC', 'apis/rpc')
config.add_view(jsonrpc_endpoint, route_name='JSON-RPC')
config.add_view(route_name='JSON-RPC', name='dummy_rpc',
view='remotelogger.views.logger.RemoteLogger.dummy_rpc',
mapper=JsonRpcViewMapper,
renderer=renderer)
*
And the class containing the dummy_rpc method in file remotelogger/
views/logger.py is:
**
class RemoteLogger(Subject):
A service that provides the logging methods.
It notifies the observers when a log message is received
and the message log level is less or equal to the current log
level
def __init__(self):
Subject.__init__(self)
self.loglevel = INFO
def dummy_rpc(self, request, a, b):
print request
return a+b
**
If I define the dummy_rpc method as a module method outside the
RemoteLogger class then everything works fine and I get back the
expected result.
**
config.add_view(route_name='JSON-RPC', name='dummy_rpc',
view='remotelogger.views.logger.dummy_rpc',
mapper=JsonRpcViewMapper,
renderer=renderer)
---
...POST /apis/rpc HTTP/1.0
Content-Length: 73
Content-Type: application/json
Host: localhost:80
{params: [2, 3], jsonrpc: 2.0, method: dummy_rpc, id:
test}
Response ---
{u'jsonrpc': u'2.0', u'id': u'test', u'result': 5}
*
Can you please point me in the right direction?
Thanks.
--Abhinav
--
You received this message because you are subscribed to the Google Groups
pylons-devel group.
To post to this group, send email to pylons-devel@googlegroups.com.
To unsubscribe from this group, send email to
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/pylons-devel?hl=en.