utils.py
changeset 5385 b6e250dd7a7d
parent 5328 c51e8f62652a
parent 5377 84d14ddfae13
child 5408 120db445c179
--- a/utils.py	Fri Apr 23 11:10:30 2010 +0200
+++ b/utils.py	Fri Apr 23 12:42:53 2010 +0200
@@ -310,14 +310,17 @@
 
 
 try:
-    # may not be there if cubicweb-web not installed
-    from simplejson import dumps, JSONEncoder
+    try:
+        # may not be there if cubicweb-web not installed
+        from json import dumps, JSONEncoder
+    except ImportError:
+        from simplejson import dumps, JSONEncoder
 except ImportError:
     pass
 else:
 
     class CubicWebJsonEncoder(JSONEncoder):
-        """define a simplejson encoder to be able to encode yams std types"""
+        """define a json encoder to be able to encode yams std types"""
 
         # _iterencode is the only entry point I've found to use a custom encode
         # hook early enough: .default() is called if nothing else matched before,