response['X-Object-Version-Timestamp'] = http_date(int(meta['version_timestamp']))
for k in [x for x in meta.keys() if x.startswith('X-Object-Meta-')]:
response[k.encode('utf-8')] = meta[k].encode('utf-8')
- for k in ('Content-Encoding', 'Content-Disposition', 'X-Object-Manifest', 'X-Object-Sharing', 'X-Object-Shared-By'):
+ for k in ('Content-Encoding', 'Content-Disposition', 'X-Object-Manifest', 'X-Object-Sharing', 'X-Object-Shared-By', 'X-Object-Public'):
if k in meta:
response[k] = meta[k]
else:
if '/'.join((v_account, v_container, v_object)) != perm_path:
meta['X-Object-Shared-By'] = perm_path
+def update_public_meta(public, meta):
+ if not public:
+ return
+ meta['X-Object-Public'] = public
+
def validate_modification_preconditions(request, meta):
"""Check that the modified timestamp conforms with the preconditions set."""
raise BadRequest('Invalid sharing header')
except AttributeError:
raise Conflict('Sharing already set above or below this path in the hierarchy')
+ if public is not None:
+ try:
+ backend.update_object_public(request.user, v_account, v_container, v_object, public)
+ except NotAllowedError:
+ raise Unauthorized('Access denied')
+ except NameError:
+ raise ItemNotFound('Object does not exist')
def get_int_parameter(request, name):
p = request.GET.get(name)