From 488744a005fb399af8d094ad7a62c1917410398c Mon Sep 17 00:00:00 2001 From: venkata edara Date: Wed, 22 Nov 2017 13:35:46 +0530 Subject: Rebase to Swift 2.15.1 (pike) Change-Id: I84ebb44c5c3cf2f80c50f2d4ae4bd92b619a4297 Signed-off-by: venkata edara Reviewed-on: https://review.gluster.org/18412 Reviewed-by: Prashanth Pai Tested-by: Prashanth Pai --- gluster/swift/account/utils.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'gluster/swift/account/utils.py') diff --git a/gluster/swift/account/utils.py b/gluster/swift/account/utils.py index 4424835..24fb7df 100644 --- a/gluster/swift/account/utils.py +++ b/gluster/swift/account/utils.py @@ -15,7 +15,7 @@ from swift.account.utils import FakeAccountBroker, get_response_headers from swift.common.swob import HTTPOk, HTTPNoContent -from swift.common.utils import json +from swift.common.utils import json, Timestamp from xml.sax import saxutils @@ -37,24 +37,29 @@ def account_listing_response(account, req, response_content_type, broker=None, response_content_type, reverse) if response_content_type == 'application/json': data = [] - for (name, object_count, bytes_used, is_subdir) in account_list: + for (name, object_count, bytes_used, put_tstamp, + is_subdir) in account_list: if is_subdir: data.append({'subdir': name}) else: data.append({'name': name, 'count': object_count, - 'bytes': bytes_used}) + 'bytes': bytes_used, + 'last_modified': Timestamp(put_tstamp).isoformat}) account_list = json.dumps(data) elif response_content_type.endswith('/xml'): output_list = ['', '' % saxutils.quoteattr(account)] - for (name, object_count, bytes_used, is_subdir) in account_list: + for (name, object_count, bytes_used, put_tstamp, + is_subdir) in account_list: if is_subdir: output_list.append( '' % saxutils.quoteattr(name)) else: item = '%s%s' \ - '%s' % \ - (saxutils.escape(name), object_count, bytes_used) + '%s%s \ + ' % \ + (saxutils.escape(name), object_count, bytes_used, + Timestamp(put_tstamp).isoformat) output_list.append(item) output_list.append('') account_list = '\n'.join(output_list) -- cgit