-
Notifications
You must be signed in to change notification settings - Fork 16
Conversation
6c448f3
to
e723bd9
Compare
AFAIK it doesn't seems to fix the problem. |
Or maybe it is because of missing |
e723bd9
to
de610e6
Compare
I added the option but I have no idea if it will actually works with normal json. |
@leplatrem any idea of how to handle this? |
@@ -50,7 +50,8 @@ def setup_json_serializer(config): | |||
requests.models.json = utils.json | |||
|
|||
# Override json renderer using ujson | |||
renderer = JSONRenderer(serializer=lambda v, **kw: utils.json.dumps(v)) | |||
renderer = JSONRenderer(serializer=lambda v, **kw: utils.json.dumps( | |||
v, escape_forward_slashes=False)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The escape_forward_slashes only works with ultrajson.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The authors could not publish the version with the escape option on Pypi yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The authors could not publish the version with the escape option on Pypi yet
The ujson people couldn't but a fork ultrajson was made available with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The escape_forward_slashes only works with ultrajson.
What if we do renderer = JSONRenderer(serializer=utils.json_serializer)
?
@leplatrem well it doesn't really change the matter on this PR but ok I understand that. |
With my last commit I've got two test failing on this kind of JSON:
|
except ImportError: # pragma: no cover | ||
import json # NOQA | ||
|
||
def json_serializer(v, **kw): | ||
return json.dumps(v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'm not 100% sure that it is better, but you can do json_serializer = json.dumps
46c802f
to
90ebf61
Compare
import ultrajson as json # NOQA | ||
|
||
def json_serializer(v, **kw): | ||
return json.dumps(v, escape_forward_slashes=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'm not 100% sure that it is better, but you could do json_serializer = functools.partial(json.dumps, escape_forward_slashes=False)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Telepathy for the win 👍
Well it is even worse actually :( |
Yes it is what I also noticed, do you know if it is a bug with your ultrajson fix? |
I guess it is a known bug, with a pending PR to fix it.
|
I updated this. Needs rebase. |
Let me rebase then 👍 |
03a70ef
to
d4b4691
Compare
@Natim final r+ ? |
GG mat r+ |
Document how to upgrade Kinto
Refs mozilla-services/readinglist#224