~sil/u1db/http-all-docs

« back to all changes in this revision

Viewing changes to u1db/backends/sqlite_backend.py

  • Committer: Tarmac
  • Author(s): Eric Casteleijn
  • Date: 2012-08-14 14:55:10 UTC
  • mfrom: (375.1.1 deprecate-simplejson)
  • Revision ID: tarmac-20120814145510-9q1yb1vt8oyrgpo9
Removed simplejson as a hard dependency. It will still be used if present.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import errno
20
20
import os
21
 
import simplejson
 
21
try:
 
22
    import simplejson as json
 
23
except ImportError:
 
24
    import json  # noqa
22
25
from sqlite3 import dbapi2
23
26
import sys
24
27
import time
853
856
    def _put_and_update_indexes(self, old_doc, doc):
854
857
        c = self._db_handle.cursor()
855
858
        if doc and not doc.is_tombstone():
856
 
            raw_doc = simplejson.loads(doc.get_json())
 
859
            raw_doc = json.loads(doc.get_json())
857
860
        else:
858
861
            raw_doc = {}
859
862
        if old_doc is not None:
917
920
        for doc_id, doc in self._iter_all_docs():
918
921
            if doc is None:
919
922
                continue
920
 
            raw_doc = simplejson.loads(doc)
 
923
            raw_doc = json.loads(doc)
921
924
            self._update_indexes(doc_id, raw_doc, getters, c)
922
925
 
923
926
SQLiteDatabase.register_implementation(SQLitePartialExpandDatabase)