diff options
author | Victor Shyba <victor1984@riseup.net> | 2017-07-05 02:17:38 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2017-07-18 15:30:29 -0300 |
commit | 463073b3147f9ba4e784e92cc8bec1d74ab0b7f4 (patch) | |
tree | 63eef25b803e9627bab4b0bef1571606b18e6f3e /src | |
parent | 1b71b5c3f5df1c88f61ac2c57abe791f47027143 (diff) |
[feature] add blobs as a incoming api backend
We started with CouchDB due legacy system relying on it. This commit
adds the possibility of adding blobs as a IncomingAPI backend if blobs
is enabled on config file.
-- Resolves: #8868
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/soledad/server/_blobs.py | 1 | ||||
-rw-r--r-- | src/leap/soledad/server/_incoming.py | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/leap/soledad/server/_blobs.py b/src/leap/soledad/server/_blobs.py index 87b171fb..f6a8cbc6 100644 --- a/src/leap/soledad/server/_blobs.py +++ b/src/leap/soledad/server/_blobs.py @@ -256,4 +256,5 @@ class BlobsServerState(object): That method is just for compatibility with CouchServerState, so IncomingAPI can change backends. """ + # TODO: deprecate/refactor it as it's here for compatibility. return self.backend diff --git a/src/leap/soledad/server/_incoming.py b/src/leap/soledad/server/_incoming.py index 6fdeb7ae..8d057ae9 100644 --- a/src/leap/soledad/server/_incoming.py +++ b/src/leap/soledad/server/_incoming.py @@ -40,6 +40,10 @@ def _get_backend_from_config(): return CouchServerState(conf['couch_url']) +def uses_legacy(db): + return hasattr(db, 'put_doc') + + class IncomingResource(Resource): isLeaf = True @@ -51,7 +55,7 @@ class IncomingResource(Resource): uuid, doc_id = request.postpath scheme = EncryptionSchemes.PUBKEY db = self.factory.open_database(uuid) - if hasattr(db, 'put_doc'): + if uses_legacy(db): doc = ServerDocument(doc_id) doc.content = self.formatter.format(request.content.read(), scheme) db.put_doc(doc) |