utils.py
branchstable
changeset 5377 84d14ddfae13
parent 5320 848e92bb81cc
child 5385 b6e250dd7a7d
child 5389 809d3b5b3d31
--- a/utils.py	Thu Apr 22 19:37:56 2010 +0000
+++ b/utils.py	Thu Apr 22 19:48:04 2010 +0000
@@ -339,14 +339,17 @@
     return __answer_cache[0]
 
 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,