File tree 3 files changed +9
-5
lines changed
3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 97
97
98
98
# pytest-recording cache
99
99
cassettes
100
+
101
+ # snyk
102
+ .dccache
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ def exceptions(e):
117
117
118
118
# NOTE: craft user messages
119
119
if hasattr (e , "code" ):
120
- code = e .code
120
+ code = int ( e .code )
121
121
122
122
# NOTE: return an http error for methods with no body allowed. This prevents undesired exceptions.
123
123
NO_PAYLOAD_METHODS = "HEAD"
Original file line number Diff line number Diff line change 16
16
# See the License for the specific language governing permissions and
17
17
# limitations under the License.
18
18
"""Renku service views."""
19
- from flask import current_app
19
+ from flask import jsonify
20
+ from marshmallow import Schema
20
21
21
22
from renku .ui .service .config import SVC_ERROR_GENERIC
22
23
from renku .ui .service .serializers .rpc import JsonRPCResponse
23
24
24
25
25
- def result_response (serializer , data ):
26
+ def result_response (serializer : Schema , data ):
26
27
"""Construct flask response."""
27
- return current_app . response_class ( response = serializer .dumps ({"result" : data }), mimetype = "application/json" )
28
+ return jsonify ( serializer .dump ({"result" : data }))
28
29
29
30
30
31
def error_response (serviceError ):
@@ -40,4 +41,4 @@ def error_response(serviceError):
40
41
if hasattr (serviceError , "sentry" ):
41
42
error ["sentry" ] = serviceError .sentry
42
43
43
- return current_app . response_class ( response = JsonRPCResponse ().dumps ({"error" : error }), mimetype = "application/json" )
44
+ return jsonify ( JsonRPCResponse ().dump ({"error" : error }))
You can’t perform that action at this time.
0 commit comments