Revision 2c22e4ac pithos/api/util.py
b/pithos/api/util.py | ||
---|---|---|
166 | 166 |
if if_none_match == '*' or meta['hash'] in [x.lower() for x in parse_etags(if_none_match)]: |
167 | 167 |
raise NotModified('Resource Etag matches') |
168 | 168 |
|
169 |
def copy_or_move_object(request, src_path, dest_path, move=False): |
|
169 |
def copy_or_move_object(request, v_account, src_path, dest_path, move=False):
|
|
170 | 170 |
"""Copy or move an object.""" |
171 | 171 |
if type(src_path) == str: |
172 | 172 |
parts = src_path.split('/') |
... | ... | |
188 | 188 |
meta = get_object_meta(request) |
189 | 189 |
# Keep previous values of 'Content-Type' (if a new one is absent) and 'hash'. |
190 | 190 |
try: |
191 |
src_meta = backend.get_object_meta(request.user, src_container, src_name)
|
|
191 |
src_meta = backend.get_object_meta(v_account, src_container, src_name)
|
|
192 | 192 |
except NameError: |
193 | 193 |
raise ItemNotFound('Container or object does not exist') |
194 | 194 |
if 'Content-Type' in meta and 'Content-Type' in src_meta: |
... | ... | |
200 | 200 |
# TODO: Copy or move with 'versioned' set. |
201 | 201 |
try: |
202 | 202 |
if move: |
203 |
backend.move_object(request.user, src_container, src_name, dest_container, dest_name, meta, replace_meta=True)
|
|
203 |
backend.move_object(v_account, src_container, src_name, dest_container, dest_name, meta, replace_meta=True)
|
|
204 | 204 |
else: |
205 |
backend.copy_object(request.user, src_container, src_name, dest_container, dest_name, meta, replace_meta=True)
|
|
205 |
backend.copy_object(v_account, src_container, src_name, dest_container, dest_name, meta, replace_meta=True)
|
|
206 | 206 |
except NameError: |
207 | 207 |
raise ItemNotFound('Container or object does not exist') |
208 | 208 |
|
... | ... | |
517 | 517 |
try: |
518 | 518 |
if http_method and request.method != http_method: |
519 | 519 |
raise BadRequest('Method not allowed.') |
520 |
|
|
520 |
|
|
521 | 521 |
# The args variable may contain up to (account, container, object). |
522 | 522 |
if len(args) > 1 and len(args[1]) > 256: |
523 | 523 |
raise BadRequest('Container name too large.') |
Also available in: Unified diff