Skip to content

Instantly share code, notes, and snippets.

@clayg
Created February 22, 2014 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayg/9148820 to your computer and use it in GitHub Desktop.
Save clayg/9148820 to your computer and use it in GitHub Desktop.
diff --git a/swift/obj/server.py b/swift/obj/server.py
index 4ce53dd..ddca987 100644
--- a/swift/obj/server.py
+++ b/swift/obj/server.py
@@ -510,8 +510,12 @@ class ObjectController(object):
pass
response.headers['X-Timestamp'] = file_x_ts
resp = request.get_response(response)
- except (DiskFileNotExist, DiskFileQuarantined):
- resp = HTTPNotFound(request=request, conditional_response=True)
+ except (DiskFileNotExist, DiskFileQuarantined) as e:
+ headers = {}
+ if hasattr(e, 'timestamp'):
+ headers['X-Timestamp'] = e.timestamp
+ resp = HTTPNotFound(request=request, headers=headers,
+ conditional_response=True)
return resp
@public
@@ -527,8 +531,12 @@ class ObjectController(object):
return HTTPInsufficientStorage(drive=device, request=request)
try:
metadata = disk_file.read_metadata()
- except (DiskFileNotExist, DiskFileQuarantined):
- return HTTPNotFound(request=request, conditional_response=True)
+ except (DiskFileNotExist, DiskFileQuarantined) as e:
+ headers = {}
+ if hasattr(e, 'timestamp'):
+ headers['X-Timestamp'] = e.timestamp
+ return HTTPNotFound(request=request, headers=headers,
+ conditional_response=True)
response = Response(request=request, conditional_response=True)
response.headers['Content-Type'] = metadata.get(
'Content-Type', 'application/octet-stream')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment