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 | 8a887bb41c56da368fb1410c63da117566374858 (patch) | |
tree | a8779207a00640bb32d9b12196f58e2f6d454699 /src/leap/soledad/backends/leap_backend.py | |
parent | be3a837c912d3dc90386334e5e389813aa77773a (diff) |
SQLCipher backend can sync with remote Leap HTTP target.
Diffstat (limited to 'src/leap/soledad/backends/leap_backend.py')
-rw-r--r-- | src/leap/soledad/backends/leap_backend.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/leap/soledad/backends/leap_backend.py b/src/leap/soledad/backends/leap_backend.py index d3ae6db6..a2208404 100644 --- a/src/leap/soledad/backends/leap_backend.py +++ b/src/leap/soledad/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): """ |