Merge "Don't use float() when normalize_timestamp() does it."

This commit is contained in:
Jenkins 2013-08-28 23:09:32 +00:00 committed by Gerrit Code Review
commit c809a3effd
2 changed files with 7 additions and 3 deletions
swift
common
proxy/controllers

@ -425,7 +425,11 @@ def drop_buffer_cache(fd, offset, length):
def normalize_timestamp(timestamp):
"""
Format a timestamp (string or numeric) into a standardized
xxxxxxxxxx.xxxxx format.
xxxxxxxxxx.xxxxx (10.5) format.
Note that timestamps using values greater than or equal to November 20th,
2286 at 17:46 UTC will use 11 digits to represent the number of
seconds.
:param timestamp: unix timestamp
:returns: normalized timestamp as a string

@ -861,7 +861,7 @@ class ObjectController(Controller):
if 'x-timestamp' in req.headers:
try:
req.headers['X-Timestamp'] = \
normalize_timestamp(float(req.headers['x-timestamp']))
normalize_timestamp(req.headers['x-timestamp'])
if hresp.environ and 'swift_x_timestamp' in hresp.environ and \
float(hresp.environ['swift_x_timestamp']) >= \
float(req.headers['x-timestamp']):
@ -1210,7 +1210,7 @@ class ObjectController(Controller):
if 'x-timestamp' in req.headers:
try:
req.headers['X-Timestamp'] = \
normalize_timestamp(float(req.headers['x-timestamp']))
normalize_timestamp(req.headers['x-timestamp'])
except ValueError:
return HTTPBadRequest(
request=req, content_type='text/plain',