Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* S3/S3.py: Support for buckets with over 1000 objects.

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@147 830e0280-6d2a-0410-9c65-932aecc39d9d
  • Loading branch information...
commit d94adea9e7c2e80ad5c1dae6858cad68069c9370 1 parent aa1c976
@mludvig mludvig authored
Showing with 19 additions and 5 deletions.
  1. +4 −0 ChangeLog
  2. +1 −0  NEWS
  3. +14 −5 S3/S3.py
View
4 ChangeLog
@@ -1,3 +1,7 @@
+2007-09-13 Michal Ludvig <michal@logix.cz>
+
+ * S3/S3.py: Support for buckets with over 1000 objects.
+
2007-09-03 Michal Ludvig <michal@logix.cz>
* s3cmd: Small tweaks to --configure workflow.
View
1  NEWS
@@ -2,6 +2,7 @@ s3cmd 0.9.5 - ???
===========
* Much better handling of multiple args to put, get and del
* Tries to use ElementTree from any available module
+* Support for buckets with over 1000 objects.
s3cmd 0.9.4 - 2007-08-13
===========
View
19 S3/S3.py
@@ -105,14 +105,23 @@ def list_all_buckets(self):
return response
def bucket_list(self, bucket, prefix = None):
- ## TODO: use prefix if supplied
+ def _list_truncated(data):
+ return getTextFromXml(data, ".//IsTruncated").lower() != "false"
+
+ def _get_contents(data):
+ return getListFromXml(data, "Contents")
+
request = self.create_request("BUCKET_LIST", bucket = bucket, prefix = prefix)
response = self.send_request(request)
#debug(response)
- response["list"] = getListFromXml(response["data"], "Contents")
- is_truncated = getTextFromXml(response['data'], ".//IsTruncated")
- if is_truncated and is_truncated.lower() != "false":
- raise Exception("Listing truncated. Please notify s3cmd developers.")
+ list = _get_contents(response["data"])
+ while _list_truncated(response["data"]):
+ marker = list[-1]["Key"]
+ info("Listing continues after '%s'" % marker)
+ request = self.create_request("BUCKET_LIST", bucket = bucket, prefix = prefix, marker = marker)
+ response = self.send_request(request)
+ list += _get_contents(response["data"])
+ response['list'] = list
return response
def bucket_create(self, bucket):
Please sign in to comment.
Something went wrong with that request. Please try again.