Browse code

python 2.4 doesn't have x=foo if a else b

Matt Domsch authored on 2014/03/14 10:35:40
Showing 1 changed files
... ...
@@ -542,10 +542,18 @@ def subcmd_batch_del(uri_str = None, bucket = None, remote_list = None):
542 542
             response = s3.object_batch_delete(remote_list)
543 543
             output('\n'.join((u"File %s deleted" % remote_list[p]['object_uri_str']) for p in remote_list))
544 544
 
545
-        keys_count = len(remote_list) if remote_list else 0
545
+        if remote_list:
546
+            keys_count = len(remote_list)
547
+        else:
548
+            keys_count = 0
546 549
         if keys_count < 1000 or not batch_mode:
547 550
             break
548
-        last_key = S3Uri(remote_list[remote_list.keys()[-1]]['object_uri_str']) if remote_list else None
551
+
552
+        if remote_list:
553
+            last_key = S3Uri(remote_list[remote_list.keys()[-1]]['object_uri_str'])
554
+        else:
555
+            last_key = None
556
+
549 557
         if not last_key or not last_key.has_object:
550 558
             break
551 559
         marker = last_key.object()