diff options
author | Robert Brewer <fumanchu@aminus.org> | 2010-12-30 05:12:03 +0000 |
---|---|---|
committer | Robert Brewer <fumanchu@aminus.org> | 2010-12-30 05:12:03 +0000 |
commit | a433ee1b67032c1dbeeaf345cb5fe81f7f870f25 (patch) | |
tree | 47aed1b233af9e8dbeac23485a29879768ab058f /cherrypy/lib/jsontools.py | |
parent | dbc05b4a93cb0c6a89eb68bcc2b29e1eb46a89f7 (diff) | |
download | cherrypy-git-a433ee1b67032c1dbeeaf345cb5fe81f7f870f25.tar.gz |
Prefer simplejson to the builtin json module. It's usually more advanced and has optional C speedups.
Diffstat (limited to 'cherrypy/lib/jsontools.py')
-rw-r--r-- | cherrypy/lib/jsontools.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cherrypy/lib/jsontools.py b/cherrypy/lib/jsontools.py index 14ad11bc..89faf326 100644 --- a/cherrypy/lib/jsontools.py +++ b/cherrypy/lib/jsontools.py @@ -1,13 +1,14 @@ import sys import cherrypy -if sys.version_info >= (2, 6): - # Python 2.6: simplejson is part of the standard library - import json -else: - try: - import simplejson as json - except ImportError: +try: + # Prefer simplejson, which is usually more advanced than the builtin module. + import simplejson as json +except ImportError: + if sys.version_info >= (2, 6): + # Python 2.6: simplejson is part of the standard library + import json + else: json = None if json is None: |