diff options
author | drebs <drebs@leap.se> | 2013-02-09 22:09:03 -0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-02-09 22:22:15 -0200 |
commit | 2a1f96729fb694257cab220022ea81731133dca6 (patch) | |
tree | 524ac41103501f45bfb884a5ebe8d3f0f6ccad4f /backends/leap_backend.py | |
parent | d139faf6bb7adcc4ea1e8dcafad38fbeccc552d8 (diff) |
SQLCipher backend can sync with remote Leap HTTP target.
Diffstat (limited to 'backends/leap_backend.py')
-rw-r--r-- | backends/leap_backend.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/backends/leap_backend.py b/backends/leap_backend.py index d3ae6db6..a2208404 100644 --- a/backends/leap_backend.py +++ b/backends/leap_backend.py @@ -92,7 +92,15 @@ class LeapDatabase(HTTPDatabase): def __init__(self, url, document_factory=None, creds=None, soledad=None): super(LeapDatabase, self).__init__(url, creds=creds) self._soledad = soledad - self._factory = LeapDocument + + # wrap soledad in factory + def factory(doc_id=None, rev=None, json='{}', has_conflicts=False, + encrypted_json=None, syncable=True): + return LeapDocument(doc_id=doc_id, rev=rev, json=json, + has_conflicts=has_conflicts, + encrypted_json=encrypted_json, + syncable=syncable, soledad=self._soledad) + self.set_document_factory(factory) @staticmethod def open_database(url, create): @@ -115,15 +123,6 @@ class LeapDatabase(HTTPDatabase): st._creds = self._creds return st - def create_doc_from_json(self, content, doc_id=None): - if doc_id is None: - doc_id = self._allocate_doc_id() - res, headers = self._request_json('PUT', ['doc', doc_id], {}, - content, 'application/json') - new_doc = self._factory(doc_id, res['rev'], content, - soledad=self._soledad) - return new_doc - class LeapSyncTarget(HTTPSyncTarget): """ |