Skip to content

Commit

Permalink
fixed a problem with eventhandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed L committed Feb 1, 2012
1 parent 92ada27 commit 7b0a839
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions jsonrpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7b0a839

Please sign in to comment.