##// END OF EJS Templates
API returns proper JSON response
marcink -
r1661:fe5575f9 beta
parent child Browse files
Show More
@@ -36,7 +36,7 b' from rhodecode.lib.compat import izip_lo'
36 from paste.response import replace_header
36 from paste.response import replace_header
37
37
38 from pylons.controllers import WSGIController
38 from pylons.controllers import WSGIController
39 from pylons.controllers.util import Response
39
40
40
41 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError, \
41 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError, \
42 HTTPBadRequest, HTTPError
42 HTTPBadRequest, HTTPError
@@ -56,9 +56,15 b' class JSONRPCError(BaseException):'
56
56
57
57
58 def jsonrpc_error(message, code=None):
58 def jsonrpc_error(message, code=None):
59 """Generate a Response object with a JSON-RPC error body"""
59 """
60 return Response(body=json.dumps(dict(result=None,
60 Generate a Response object with a JSON-RPC error body
61 error=message)))
61 """
62 from pylons.controllers.util import Response
63 resp = Response(body=json.dumps(dict(result=None, error=message)),
64 status=code,
65 content_type='application/json')
66 return resp
67
62
68
63
69
64 class JSONRPCController(WSGIController):
70 class JSONRPCController(WSGIController):
General Comments 0
You need to be logged in to leave comments. Login now