Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed a problem with eventhandler

  • Loading branch information...
commit 7b0a83959e220816187410df0ecda550005f3677 1 parent 92ada27
Ed L authored
Showing with 8 additions and 4 deletions.
  1. +1 −1  doc/source/conf.py
  2. +7 −3 jsonrpc/server.py
View
2  doc/source/conf.py
@@ -77,7 +77,7 @@
master_doc = 'index'
# General information about the project.
-project = u'JSONRPC'
+project = u'JSON-RPC'
copyright = u'2011, Edward Langley'
# The version info for the project you're documenting, acts as replacement for
View
10 jsonrpc/server.py
@@ -90,7 +90,7 @@ def findmethod(self, method_name, args=None, kwargs=None):
:returns: a callable or None if the method is not found'''
if self.methods is not None:
- return self.methods.get_method(method_name)
+ return self.methods.get(method_name)
else:
raise NotImplementedError
@@ -134,7 +134,7 @@ def defer(self, method, *a, **kw):
return threads.deferToThread(method, *a, **kw)
def defer_with_rpcrequest(self, method, rpcrequest, *a, **kw):
- d = threads.deferToThread(method, rpcrequest, *a, **kw)
+ d = self.defer(method, rpcrequest, *a, **kw)
@d.addCallback
def _inner(result):
@@ -177,7 +177,9 @@ def render(self, request):
try:
try:
content = jsonrpc.jsonutil.decode(request.content.read())
- except ValueError: raise jsonrpc.common.ParseError
+ except ValueError:
+ self.eventhandler.log(None, request, True)
+ raise jsonrpc.common.ParseError
content = self.eventhandler.processcontent(content, request)
@@ -212,6 +214,7 @@ def _action(self, request, contents, **kw):
if contents == []: raise jsonrpc.common.InvalidRequest
def callmethod(rpcrequest, request, add, **kwargs):
+ print 'jsonrpc.server callmethod: %s, %s, %s, %s' % (rpcrequest, request, add, kwargs)
add.update(kwargs)
result = self.eventhandler.callmethod(request, rpcrequest, **add)
return result
@@ -240,6 +243,7 @@ def helper(deferredresults):
methodresult.raiseException()
except Exception, e:
res = self.render_error(e, rpcrequest.id)
+ self.eventhandler.log(res, request, error=True)
if res.id is not None:
result.append(res)
Please sign in to comment.
Something went wrong with that request. Please try again.