summaryrefslogtreecommitdiff
path: root/src/leap/soledad/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/soledad/server')
-rw-r--r--src/leap/soledad/server/_blobs.py13
-rw-r--r--src/leap/soledad/server/interfaces.py3
2 files changed, 12 insertions, 4 deletions
diff --git a/src/leap/soledad/server/_blobs.py b/src/leap/soledad/server/_blobs.py
index c0b3b237..f9166ce0 100644
--- a/src/leap/soledad/server/_blobs.py
+++ b/src/leap/soledad/server/_blobs.py
@@ -147,6 +147,7 @@ class FilesystemBlobsBackend(object):
os.unlink(blob_path + '.flags')
except Exception:
pass
+ return defer.succeed(None)
def get_blob_size(self, user, blob_id, namespace=''):
blob_path = self._get_path(user, blob_id, namespace)
@@ -303,13 +304,17 @@ class BlobsResource(resource.Resource):
def render_DELETE(self, request):
logger.info("http put: %s" % request.path)
user, blob_id, namespace = self._validate(request)
- try:
- self._handler.delete_blob(user, blob_id, namespace=namespace)
- return ''
- except BlobNotFound:
+
+ def catchBlobNotFound(failure):
+ failure.trap(BlobNotFound)
request.setResponseCode(404)
return "Blob doesn't exists: %s" % blob_id
+ d = self._handler.delete_blob(user, blob_id, namespace=namespace)
+ d.addCallback(lambda _: request.finish())
+ d.addErrback(catchBlobNotFound)
+ return NOT_DONE_YET
+
def render_PUT(self, request):
logger.info("http put: %s" % request.path)
user, blob_id, namespace = self._validate(request)
diff --git a/src/leap/soledad/server/interfaces.py b/src/leap/soledad/server/interfaces.py
index 3bf6eaa9..f9257c9b 100644
--- a/src/leap/soledad/server/interfaces.py
+++ b/src/leap/soledad/server/interfaces.py
@@ -69,6 +69,9 @@ class IBlobsBackend(Interface):
:type blob_id: str
:param namespace: An optional namespace for the blob.
:type namespace: str
+
+ :return: A deferred that fires when the blob has been deleted.
+ :rtype: twisted.internet.defer.Deferred
"""
def get_blob_size(user, blob_id, namespace=''):