Revision 24484999
b/pithos/backends/dummy.py | ||
---|---|---|
18 | 18 |
|
19 | 19 |
def get_account_meta(self, account): |
20 | 20 |
""" returns a dictionary with the container metadata """ |
21 |
logging.info("get_account_meta: %s %s", account)
|
|
21 |
logging.info("get_account_meta: %s", account) |
|
22 | 22 |
fullname = '/'.join([self.basepath, account]) |
23 | 23 |
if not os.path.exists(fullname): |
24 | 24 |
raise NameError('Account does not exist') |
25 | 25 |
contents = os.listdir(fullname) |
26 | 26 |
count = len(contents) |
27 | 27 |
size = sum(os.path.getsize('/'.join([self.basepath, account, objectname])) for objectname in contents) |
28 |
return {'name': name, 'count': count, 'bytes': size}
|
|
28 |
return {'name': account, 'count': count, 'bytes': size}
|
|
29 | 29 |
|
30 | 30 |
def create_container(self, account, name): |
31 | 31 |
""" creates a new container with the given name |
32 | 32 |
if it doesn't exists under the basepath """ |
33 |
logging.debug("create_container: %s %s", account, name)
|
|
33 |
logging.info("create_container: %s %s", account, name)
|
|
34 | 34 |
fullname = '/'.join([self.basepath, account, name]) |
35 | 35 |
if not os.path.exists(fullname): |
36 |
os.chdir(self.basepath) |
|
37 |
os.mkdir(name) |
|
36 |
os.makedirs(fullname) |
|
38 | 37 |
else: |
39 | 38 |
raise NameError('Container already exists') |
40 | 39 |
return |
Also available in: Unified diff