Revision c2b5da2f kamaki/clients/storage/__init__.py
b/kamaki/clients/storage/__init__.py | ||
---|---|---|
72 | 72 |
path = path4url(self.account) |
73 | 73 |
for key, val in metapairs.items(): |
74 | 74 |
self.set_header('X-Account-Meta-' + key, val) |
75 |
r = self.post(path, success=202) |
|
76 |
r.release() |
|
75 |
self.post(path, success=202) |
|
77 | 76 |
|
78 | 77 |
def del_account_meta(self, metakey): |
79 | 78 |
""" |
... | ... | |
87 | 86 |
if len(self.headers) == len(headers): |
88 | 87 |
raise ClientError('X-Account-Meta-%s not found' % metakey, 404) |
89 | 88 |
path = path4url(self.account) |
90 |
r = self.post(path, success=202) |
|
91 |
r.release() |
|
89 |
self.post(path, success=202) |
|
92 | 90 |
|
93 | 91 |
def create_container(self, container): |
94 | 92 |
""" |
... | ... | |
99 | 97 |
self._assert_account() |
100 | 98 |
path = path4url(self.account, container) |
101 | 99 |
r = self.put(path, success=(201, 202)) |
102 |
r.release() |
|
103 | 100 |
if r.status_code == 202: |
104 | 101 |
raise ClientError("Container already exists", r.status_code) |
105 | 102 |
|
... | ... | |
157 | 154 |
self._assert_container() |
158 | 155 |
path = path4url(self.account, self.container, obj) |
159 | 156 |
data = f.read(size) if size else f.read() |
160 |
r = self.put(path, data=data, success=201) |
|
161 |
r.release() |
|
157 |
self.put(path, data=data, success=201) |
|
162 | 158 |
|
163 | 159 |
def create_object( |
164 | 160 |
self, obj, |
... | ... | |
172 | 168 |
path = path4url(self.account, self.container, obj) |
173 | 169 |
self.set_header('Content-Type', content_type) |
174 | 170 |
self.set_header('Content-length', str(content_length)) |
175 |
r = self.put(path, success=201) |
|
176 |
r.release() |
|
171 |
self.put(path, success=201) |
|
177 | 172 |
|
178 | 173 |
def create_directory(self, obj): |
179 | 174 |
""" |
... | ... | |
183 | 178 |
path = path4url(self.account, self.container, obj) |
184 | 179 |
self.set_header('Content-Type', 'application/directory') |
185 | 180 |
self.set_header('Content-length', '0') |
186 |
r = self.put(path, success=201) |
|
187 |
r.release() |
|
181 |
self.put(path, success=201) |
|
188 | 182 |
|
189 | 183 |
def get_object_info(self, obj): |
190 | 184 |
""" |
... | ... | |
220 | 214 |
self._assert_container() |
221 | 215 |
self.set_header('X-Object-Meta-' + metakey, '') |
222 | 216 |
path = path4url(self.account, self.container, obj) |
223 |
r = self.post(path, success=202) |
|
224 |
r.release() |
|
217 |
self.post(path, success=202) |
|
225 | 218 |
|
226 | 219 |
def replace_object_meta(self, metapairs): |
227 | 220 |
""" |
... | ... | |
231 | 224 |
path = path4url(self.account, self.container) |
232 | 225 |
for key, val in metapairs.items(): |
233 | 226 |
self.set_header('X-Object-Meta-' + key, val) |
234 |
r = self.post(path, success=202) |
|
235 |
r.release() |
|
227 |
self.post(path, success=202) |
|
236 | 228 |
|
237 | 229 |
def copy_object( |
238 | 230 |
self, src_container, src_object, dst_container, |
... | ... | |
253 | 245 |
dst_path = path4url(self.account, dst_container, dst_object) |
254 | 246 |
self.set_header('X-Copy-From', path4url(src_container, src_object)) |
255 | 247 |
self.set_header('Content-Length', 0) |
256 |
r = self.put(dst_path, success=201) |
|
257 |
r.release() |
|
248 |
self.put(dst_path, success=201) |
|
258 | 249 |
|
259 | 250 |
def move_object( |
260 | 251 |
self, src_container, src_object, dst_container, |
... | ... | |
275 | 266 |
dst_path = path4url(self.account, dst_container, dst_object) |
276 | 267 |
self.set_header('X-Move-From', path4url(src_container, src_object)) |
277 | 268 |
self.set_header('Content-Length', 0) |
278 |
r = self.put(dst_path, success=201) |
|
279 |
r.release() |
|
269 |
self.put(dst_path, success=201) |
|
280 | 270 |
|
281 | 271 |
def delete_object(self, obj): |
282 | 272 |
""" |
Also available in: Unified diff