From 382371e9080a558df6141623d032b8339f41010d Mon Sep 17 00:00:00 2001 From: drebs Date: Sun, 19 Mar 2017 09:42:47 +0100 Subject: [refactor] create blobs directory on server resource initialization --- server/src/leap/soledad/server/_blobs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'server/src/leap/soledad') diff --git a/server/src/leap/soledad/server/_blobs.py b/server/src/leap/soledad/server/_blobs.py index 534a5c18..e90c6672 100644 --- a/server/src/leap/soledad/server/_blobs.py +++ b/server/src/leap/soledad/server/_blobs.py @@ -103,6 +103,8 @@ class FilesystemBlobsBackend(object): quota = 200 * 1024 # in KB def __init__(self, blobs_path): + if not os.path.isdir(blobs_path): + os.makedirs(blobs_path) self.path = blobs_path def tag_header(self, user, blob_id, request): @@ -206,8 +208,9 @@ class BlobsResource(resource.Resource): # provide a configured instance of the resource _config = get_config() _path = _config['blobs_path'] - blobs_resource = BlobsResource(_path) + + if __name__ == '__main__': # A dummy blob server # curl -X PUT --data-binary @/tmp/book.pdf localhost:9000/user/someid @@ -227,9 +230,6 @@ if __name__ == '__main__': parser.add_argument('--path', default='/tmp/blobs/user') args = parser.parse_args() - if not os.path.isdir(args.path): - os.makedirs(args.path) - root = BlobsResource(args.path) # I picture somethink like # BlobsResource(backend="filesystem", backend_opts={'path': '/tmp/blobs'}) -- cgit v1.2.3