Commit 07ec88ed authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Check if container exists in upload and download

Fixes #31
parent e4e5dd3b
......@@ -1025,7 +1025,9 @@ class file_upload(_PithosContainer):
self.container, rpath),
details=['use -f to overwrite / resume'])
except ClientError as ce:
if ce.status not in (404, ):
if ce.status in (404, ):
yield open(lpath, 'rb'), rpath
......@@ -1212,16 +1214,15 @@ class file_download(_PithosContainer):
is an open file descriptor. Directories are denoted as (None, dirpath)
and they are pretended to other objects in a very strict order (shorter
to longer path)."""
ret = []
ret, obj = [], None
if self.path:
obj = self.client.get_object_info(
self.path, version=self['object_version'])
obj.setdefault('name', self.path.strip('/'))
obj = None
except ClientError as ce:
if ce.status in (404, ):
raiseCLIError(ce, details=[
'To download an object, it must exist either as a file or'
' as a directory.',
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment