diff options
author | drebs <drebs@leap.se> | 2017-03-19 09:42:47 +0100 |
---|---|---|
committer | drebs <drebs@leap.se> | 2017-04-04 18:27:35 +0200 |
commit | 382371e9080a558df6141623d032b8339f41010d (patch) | |
tree | ee8fce8d7373a75a92e60b12a1894c5e59e7896c /server/src | |
parent | c56d54501ef2b83cc9a9241a0b41739422fb7eca (diff) |
[refactor] create blobs directory on server resource initialization
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/leap/soledad/server/_blobs.py | 8 |
1 files changed, 4 insertions, 4 deletions
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'}) |