Revision 2a7292f1 kamaki/clients/pithos.py
b/kamaki/clients/pithos.py | ||
---|---|---|
73 | 73 |
def __init__(self, base_url, token, account=None, container=None): |
74 | 74 |
super(PithosClient, self).__init__(base_url, token, account, container) |
75 | 75 |
|
76 |
def purge_container(self): |
|
76 |
def purge_container(self, container=None):
|
|
77 | 77 |
"""Delete an empty container and destroy associated blocks |
78 | 78 |
""" |
79 |
r = self.container_delete(until=unicode(time())) |
|
79 |
cnt_back_up = self.container |
|
80 |
try: |
|
81 |
self.container = container or cnt_back_up |
|
82 |
r = self.container_delete(until=unicode(time())) |
|
83 |
finally: |
|
84 |
self.container = cnt_back_up |
|
80 | 85 |
r.release() |
81 | 86 |
|
82 | 87 |
def upload_object_unchunked( |
... | ... | |
124 | 129 |
msg = '"%s" is not a valid hashmap file' % f.name |
125 | 130 |
raise ClientError(msg, 1) |
126 | 131 |
f = StringIO(data) |
127 |
data = f.read(size) if size is not None else f.read() |
|
132 |
else: |
|
133 |
data = f.read(size) if size is not None else f.read() |
|
128 | 134 |
r = self.object_put( |
129 | 135 |
obj, |
130 | 136 |
data=data, |
Also available in: Unified diff