\ Always reply with the MD5 in the ETag.
\ Note that ``/login`` will only work if an external authentication system is defined.
\ Include option to ignore Content-Type on ``COPY``/``MOVE``.
-\ Use format parameter for conflict (409) replies.
+\ Use format parameter for conflict (409) and uploaded hash list (container level) replies.
0.7 (Nov 21, 2011) Suggest upload/download methods using hashmaps.
\ Propose syncing algorithm.
\ Support cross-account object copy and move.
====================== ============================================
Request Parameter Name Value
====================== ============================================
+format Optional hash list reply type (can be ``json`` or ``xml``)
update Do not replace metadata/policy (no value parameter)
====================== ============================================
-No reply content/headers, except when uploading data, where the reply consists of a list of hashes for the blocks received (in a simple text format, with one hash per line).
+No reply content/headers, except when uploading data, where the reply consists of a list of hashes for the blocks received (in the format specified).
The operation will overwrite all user defined metadata, except if ``update`` is defined.
To change policy, include an ``X-Container-Policy-*`` header with the name in the key. If no ``X-Container-Policy-*`` header is present, no changes will be applied to policy. The ``update`` parameter also applies to policy - deleted values will revert to defaults. To delete/revert a specific policy directive, use ``update`` and an empty header value. See container ``PUT`` for a reference of policy directives.
put_object_headers, update_manifest_meta, update_sharing_meta, update_public_meta,
validate_modification_preconditions, validate_matching_preconditions, split_container_object_string,
copy_or_move_object, get_int_parameter, get_content_length, get_content_range, socket_read_iterator,
- SaveToBackendHandler, object_data_response, put_object_block, hashmap_md5, object_conflict_response, api_method)
+ SaveToBackendHandler, object_data_response, put_object_block, hashmap_md5, simple_list_response, api_method)
from pithos.backends.base import NotAllowedError, QuotaError
return HttpResponse(status=ret)
-@api_method('POST')
+@api_method('POST', format_allowed=True)
def container_update(request, v_account, v_container):
# Normal Response Codes: 202
# Error Response Codes: internalServerError (500),
response = HttpResponse(status=202)
if hashmap:
- response.content = '\n'.join(hashmap) + '\n'
+ response.content = simple_list_response(request, hashmap)
return response
@api_method('DELETE')
except NotAllowedError:
raise Forbidden('Not allowed')
except IndexError, e:
- raise Conflict(object_conflict_response(request, e.data))
+ raise Conflict(simple_list_response(request, e.data))
except NameError:
raise ItemNotFound('Container does not exist')
except ValueError:
raise BadRequest('Invalid sharing header')
except AttributeError, e:
- raise Conflict(object_conflict_response(request, e.data))
+ raise Conflict(simple_list_response(request, e.data))
except QuotaError:
raise RequestEntityTooLarge('Quota exceeded')
if 'ETag' not in meta:
except ValueError:
raise BadRequest('Invalid sharing header')
except AttributeError, e:
- raise Conflict(object_conflict_response(request, e.data))
+ raise Conflict(simple_list_response(request, e.data))
if public is not None:
try:
request.backend.update_object_public(request.user_uniq, v_account,
except ValueError:
raise BadRequest('Invalid sharing header')
except AttributeError, e:
- raise Conflict(object_conflict_response(request, e.data))
+ raise Conflict(simple_list_response(request, e.data))
except QuotaError:
raise RequestEntityTooLarge('Quota exceeded')
if public is not None:
except ValueError:
raise BadRequest('Invalid sharing header')
except AttributeError, e:
- raise Conflict(object_conflict_response(request, e.data))
+ raise Conflict(simple_list_response(request, e.data))
except QuotaError:
raise RequestEntityTooLarge('Quota exceeded')
if public is not None:
md5.update(data + ('\x00' * pad))
return md5.hexdigest().lower()
-def object_conflict_response(request, l):
+def simple_list_response(request, l):
if request.serialization == 'text':
return '\n'.join(l) + '\n'
if request.serialization == 'xml':
- return render_to_string('conflicts.xml', {'conflicts': l})
+ return render_to_string('items.xml', {'items': l})
if request.serialization == 'json':
return json.dumps(l)