summaryrefslogtreecommitdiffstats
path: root/gluster/swift/account
diff options
context:
space:
mode:
authorvenkata edara <redara@redhat.com>2017-11-22 13:35:46 +0530
committerPrashanth Pai <ppai@redhat.com>2017-11-22 09:07:11 +0000
commit488744a005fb399af8d094ad7a62c1917410398c (patch)
tree714441b43e09061fc339cae6a68de5c26f0fdf52 /gluster/swift/account
parent8af00bf3fa5aa7cd29a53e5e43ea230c196d10b0 (diff)
Rebase to Swift 2.15.1 (pike)HEADmaster
Change-Id: I84ebb44c5c3cf2f80c50f2d4ae4bd92b619a4297 Signed-off-by: venkata edara <redara@redhat.com> Reviewed-on: https://review.gluster.org/18412 Reviewed-by: Prashanth Pai <ppai@redhat.com> Tested-by: Prashanth Pai <ppai@redhat.com>
Diffstat (limited to 'gluster/swift/account')
-rw-r--r--gluster/swift/account/utils.py17
1 files changed, 11 insertions, 6 deletions
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 = ['<?xml version="1.0" encoding="UTF-8"?>',
'<account name=%s>' % 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(
'<subdir name=%s />' % saxutils.quoteattr(name))
else:
item = '<container><name>%s</name><count>%s</count>' \
- '<bytes>%s</bytes></container>' % \
- (saxutils.escape(name), object_count, bytes_used)
+ '<bytes>%s</bytes><last_modified>%s</last_modified> \
+ </container>' % \
+ (saxutils.escape(name), object_count, bytes_used,
+ Timestamp(put_tstamp).isoformat)
output_list.append(item)
output_list.append('</account>')
account_list = '\n'.join(output_list)