Revision e0f916bb pithos/api/util.py
b/pithos/api/util.py | ||
---|---|---|
148 | 148 |
response['X-Object-Version-Timestamp'] = http_date(int(meta['version_timestamp'])) |
149 | 149 |
for k in [x for x in meta.keys() if x.startswith('X-Object-Meta-')]: |
150 | 150 |
response[k.encode('utf-8')] = meta[k].encode('utf-8') |
151 |
for k in ('Content-Encoding', 'Content-Disposition', 'X-Object-Manifest', 'X-Object-Sharing', 'X-Object-Shared-By'): |
|
151 |
for k in ('Content-Encoding', 'Content-Disposition', 'X-Object-Manifest', 'X-Object-Sharing', 'X-Object-Shared-By', 'X-Object-Public'):
|
|
152 | 152 |
if k in meta: |
153 | 153 |
response[k] = meta[k] |
154 | 154 |
else: |
... | ... | |
194 | 194 |
if '/'.join((v_account, v_container, v_object)) != perm_path: |
195 | 195 |
meta['X-Object-Shared-By'] = perm_path |
196 | 196 |
|
197 |
def update_public_meta(public, meta): |
|
198 |
if not public: |
|
199 |
return |
|
200 |
meta['X-Object-Public'] = public |
|
201 |
|
|
197 | 202 |
def validate_modification_preconditions(request, meta): |
198 | 203 |
"""Check that the modified timestamp conforms with the preconditions set.""" |
199 | 204 |
|
... | ... | |
255 | 260 |
raise BadRequest('Invalid sharing header') |
256 | 261 |
except AttributeError: |
257 | 262 |
raise Conflict('Sharing already set above or below this path in the hierarchy') |
263 |
if public is not None: |
|
264 |
try: |
|
265 |
backend.update_object_public(request.user, v_account, v_container, v_object, public) |
|
266 |
except NotAllowedError: |
|
267 |
raise Unauthorized('Access denied') |
|
268 |
except NameError: |
|
269 |
raise ItemNotFound('Object does not exist') |
|
258 | 270 |
|
259 | 271 |
def get_int_parameter(request, name): |
260 | 272 |
p = request.GET.get(name) |
Also available in: Unified diff