Skip to content
This repository has been archived by the owner on Dec 21, 2020. It is now read-only.

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
agroszer committed Oct 11, 2013
1 parent ea0bf49 commit 8914396
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/z3c/jsonrpc/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class JSONRPCRequest(HTTPRequest):
jsonId = None

zope.interface.implements(interfaces.IJSONRPCRequest,
interfaces.IJSONRPCApplicationRequest)
interfaces.IJSONRPCApplicationRequest)

def __init__(self, body_instream, environ, response=None):
self.form = {}
Expand Down Expand Up @@ -230,7 +230,7 @@ def processInputs(self):
self.jsonVersion
self._args = tuple(args)
# make environment, cookies, etc., available to request.get()
super(JSONRPCRequest,self).processInputs()
super(JSONRPCRequest, self).processInputs()
self._environ['JSONRPC_MODE'] = True

# split here on '.' for get path suffix steps
Expand Down Expand Up @@ -322,14 +322,16 @@ def setResult(self, result):
if jsonVersion == "1.0":
wrapper = {'result': result, 'error': None, 'id': jsonId}
elif jsonVersion == "1.1":
wrapper = {'version': jsonVersion, 'result': result, 'id': jsonId}
wrapper = {
'version': jsonVersion, 'result': result, 'id': jsonId}
else:
wrapper = {'jsonrpc': jsonVersion, 'result': result, 'id': jsonId}
wrapper = {
'jsonrpc': jsonVersion, 'result': result, 'id': jsonId}
json = zope.component.getUtility(IJSONWriter)
encoding = getCharsetUsingRequest(self._request)
result = json.write(wrapper)
body = self._prepareResult(result)
super(JSONRPCResponse,self).setResult(DirectResult((body,)))
super(JSONRPCResponse, self).setResult(DirectResult((body,)))
logger.log(DEBUG, "%s" % result)

def _prepareResult(self, result):
Expand All @@ -347,8 +349,8 @@ def _prepareResult(self, result):
raise TypeError, "JSON did not return unicode (%s)" % type(result)

# set content type
self.setHeader('content-type', "application/x-javascript;charset=%s" \
% charset)
self.setHeader('content-type', "application/x-javascript;charset=%s"
% charset)
return body

def handleException(self, exc_info):
Expand Down

0 comments on commit 8914396

Please sign in to comment.