Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubes
jsonschema
Commits
4f773b2852cd
Commit
a5656815
authored
Nov 20, 2019
by
Carine Dengler
Browse files
[py3][json] json.dumps returns text type
--HG-- branch : 0.1
parent
82e04206269c
Changes
1
Hide whitespace changes
Inline
Side-by-side
cubicweb_jsonschema/api/entities.py
View file @
4f773b28
...
...
@@ -17,6 +17,8 @@
"""cubicweb-jsonschema Pyramid views for the JSON API of entities."""
import
json
from
six
import
PY3
from
pyramid
import
httpexceptions
from
pyramid.renderers
import
render
from
pyramid.view
import
view_config
...
...
@@ -345,7 +347,10 @@ def generic_error(exc, request):
if
isinstance
(
exc
,
httpexceptions
.
HTTPException
):
if
exc
.
content_type
!=
'application/json'
:
exc
.
content_type
=
'application/json'
exc
.
body
=
json
.
dumps
({
'message'
:
exc
.
detail
})
body
=
json
.
dumps
({
'message'
:
exc
.
detail
})
if
PY3
:
body
=
body
.
encode
(
'utf-8'
)
exc
.
body
=
body
return
exc
request
.
cw_cnx
.
rollback
()
LOG
.
exception
(
'exception occurred while processing %s'
,
request
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment