summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-02-25 05:39:23 +0000
committerGerrit Code Review <review@openstack.org>2015-02-25 05:39:23 +0000
commit731707f06da899fa8fb2d521e35f850a2e1652ab (patch)
tree0a8d193fa7a101d2eb6d97b255d40b8ba338c387
parent19a298bdaa14b0c3586cbae003a6dc989870ded8 (diff)
parentfec5d068a0056f5d9ec60e5fd3bbfad9b9f13b86 (diff)
downloadpython-swiftclient-731707f06da899fa8fb2d521e35f850a2e1652ab.tar.gz
Merge "Fix crash with -l, -d /, and pseudo folders"
-rwxr-xr-xswiftclient/shell.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/swiftclient/shell.py b/swiftclient/shell.py
index ce779b3..439a92f 100755
--- a/swiftclient/shell.py
+++ b/swiftclient/shell.py
@@ -410,9 +410,8 @@ def st_list(parser, args, output_manager):
output_manager.print_msg(
item.get('name', item.get('subdir')))
else:
- item_bytes = item.get('bytes')
- total_bytes += item_bytes
if not container: # listing containers
+ item_bytes = item.get('bytes')
byte_str = prt_bytes(item_bytes, options.human)
count = item.get('count')
total_count += count
@@ -431,19 +430,23 @@ def st_list(parser, args, output_manager):
else: # list container contents
subdir = item.get('subdir')
if subdir is None:
+ item_bytes = item.get('bytes')
byte_str = prt_bytes(
item_bytes, options.human)
date, xtime = item.get(
'last_modified').split('T')
xtime = xtime.split('.')[0]
else:
- byte_str = prt_bytes(0, options.human)
+ item_bytes = 0
+ byte_str = prt_bytes(
+ item_bytes, options.human)
date = xtime = ''
item_name = subdir
if not options.totals:
output_manager.print_msg(
"%s %10s %8s %s", byte_str, date,
xtime, item_name)
+ total_bytes += item_bytes
# report totals
if options.long or options.human: