Commit 747e1344 authored by Antony Chazapis's avatar Antony Chazapis

Allow cross-account object from object update.

Fixes #1379
parent 527689ac
......@@ -25,10 +25,11 @@ Document Revisions
========================= ================================
Revision Description
========================= ================================
0.7 (Sept 29, 2011) Suggest upload/download methods using hashmaps.
0.7 (Sept 30, 2011) Suggest upload/download methods using hashmaps.
\ Propose syncing algorithm.
\ Support cross-account object copy and move.
\ Pass token as a request parameter when using ``POST`` via an HTML form.
\ Optionally use source account to update object from another object.
0.6 (Sept 13, 2011) Reply with Merkle hash as the ETag when updating objects.
\ Include version id in object replace/change replies.
\ Change conflict (409) replies format to text.
......@@ -826,6 +827,7 @@ Transfer-Encoding Set to ``chunked`` to specify incremental uploading (if us
Content-Encoding The encoding of the object (optional)
Content-Disposition The presentation style of the object (optional)
X-Source-Object Update with data from the object at path ``/<container>/<object>`` (optional, to update)
X-Source-Account The source account to update from
X-Source-Version The source version to update from (optional, to update)
X-Object-Bytes The updated object's final size (optional, when updating)
X-Object-Manifest Object parts prefix in ``<container>/<object>`` form (optional)
......
......@@ -1058,13 +1058,16 @@ def object_update(request, v_account, v_container, v_object):
elif offset > size:
raise RangeNotSatisfiable('Supplied offset is beyond object limits')
if src_object:
src_account = smart_unicode(request.META.get('HTTP_X_SOURCE_ACCOUNT'), strings_only=True)
if not src_account:
src_account = request.user
src_container, src_name = split_container_object_string(src_object)
src_container = smart_unicode(src_container, strings_only=True)
src_name = smart_unicode(src_name, strings_only=True)
src_version = request.META.get('HTTP_X_SOURCE_VERSION')
try:
src_size, src_hashmap = request.backend.get_object_hashmap(
request.user, v_account, src_container, src_name, src_version)
src_size, src_hashmap = request.backend.get_object_hashmap(request.user,
src_account, src_container, src_name, src_version)
except NotAllowedError:
raise Unauthorized('Access denied')
except NameError:
......
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