Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Commit

Permalink
@leplatrem review.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémy HUBSCHER committed Nov 3, 2015
1 parent de610e6 commit 46c802f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 1 addition & 2 deletions cliquet/initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ 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, escape_forward_slashes=False))
renderer = JSONRenderer(serializer=utils.json_serializer)
config.add_renderer('json', renderer)


Expand Down
9 changes: 8 additions & 1 deletion cliquet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@
from binascii import hexlify
from six.moves.urllib import parse as urlparse

# ujson is not installable with pypy
# ultrajson is not installable with pypy
try:
import ultrajson as json # NOQA

def json_serializer(v, **kw):
return json.dumps(v, escape_forward_slashes=False)

except ImportError: # pragma: no cover
import json # NOQA

def json_serializer(v, **kw):
return json.dumps(v)

try:
# Register psycopg2cffi as psycopg2
from psycopg2cffi import compat
Expand Down

0 comments on commit 46c802f

Please sign in to comment.