Skip to content

Commit

Permalink
Fix status call batch
Browse files Browse the repository at this point in the history
  • Loading branch information
nycholas committed Aug 10, 2015
1 parent f7cd7e5 commit 8912c51
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -22,4 +22,5 @@ dist/*
.eggs/
.venv/
.venv2/
.venv26/
htmlcov/
4 changes: 1 addition & 3 deletions flask_jsonrpc/site.py
Expand Up @@ -286,22 +286,20 @@ def response_obj(self, request, D, version_hint=JSONRPC_VERSION_DEFAULT):
return response, status

def batch_response_obj(self, request, D):
status = 200
try:
responses = [self.response_obj(request, d)[0] for d in D]
status = 200
if not responses:
raise InvalidRequestError('Empty array')
except Error as e:
for response in responses:
response.pop('result', None)
response['error'] = e.json_rpc_format
status = e.status
except Exception as e:
other_error = OtherError(e)
for response in responses:
response.pop('result', None)
response['error'] = other_error.json_rpc_format
status = other_error.status

for response in responses:
if response is None:
Expand Down

0 comments on commit 8912c51

Please sign in to comment.