Commits

benoitc  committed ffa0688

use anyjson everywhere

  • Participants
  • Parent commits 6412718
  • Tags 0.2.1

Comments (0)

Files changed (2)

File couchdbkit/loaders.py

 import socket
 import sys
 
+import anyjson
+
 from couchdbkit.exceptions import DocsPathNotFound
 from couchdbkit.resource import ResourceNotFound
 from couchdbkit.utils import *
 
         from couchdbkit import BaseDocsLoader
         import os
-        import simplejson as json
+        import anyjson
 
         class MyDocsLoader(BaseDocsLoader):
 
                 if not os.path.exists(path):
                     raise DocsPathNotFound
                 with file(path) as f:
-                    source = json.loads(f.read().decode('utf-8'))
+                    source = anyjson.deserialize(f.read().decode('utf-8'))
                 return source
     """
     
                         
                 if name.endswith('.json'):
                     try:
-                        content = json.loads(content)
+                        content = anyjson.deserialize(content)
                     except ValueError:
                         if verbose >= 2:
                             print >>sys.stderr, "Json invalid in %s" % current_path

File couchdbkit/macros.py

 import os
 import re
 import sys
-# python 2.6
-try:
-    import json 
-except ImportError:
-    import simplejson as json
+from hashlib import md5
 
-from hashlib import md5
+import anyjson
 
 from couchdbkit.utils import read_file, read_json, to_bytestring
 
         return f_string
 
     for k, v in included.iteritems():
-        varstrings.append("var %s = %s;" % (k, json.dumps(v)))
+        varstrings.append("var %s = %s;" % (k, anyjson.serialize(v)))
 
     return re_json.sub(rjson2, f_string)