Browse files

Merge pull request #4 from sudorandom/master

StorageObject.list() to use prefix
  • Loading branch information...
2 parents a49f2ab + 9223c9a commit fc027e52876a386d60a9563239390abbdd132dd2 @sudorandom sudorandom committed May 16, 2012
Showing with 7 additions and 6 deletions.
  1. +1 −1 object_storage/consts.py
  2. +6 −5 object_storage/storage_object.py
View
2 object_storage/consts.py
@@ -3,7 +3,7 @@
See COPYING for license information
"""
-__version__ = "0.4.2"
+__version__ = "0.4.3"
USER_AGENT = "sl-object-storage-python: %s" % __version__
ENDPOINTS = {
View
11 object_storage/storage_object.py
@@ -153,8 +153,8 @@ def list(self, limit=None, marker=None, base_only=False):
@raises ResponseError
@return: list of StorageObject instances
"""
- params = {'format': 'json',
- 'path': self.name}
+ params = {'format': 'json',
+ 'prefix': self.name+self.client.delimiter}
if base_only:
params['delimiter'] = self.client.delimiter
if limit:
@@ -169,12 +169,13 @@ def _formatter(res):
if 'name' in item:
objects[item['name']] = self.client.storage_object(self.container, item['name'], headers=item)
elif 'subdir' in item:
- item['name'] = item['subdir'].rstrip('/')
+ name = item['subdir'].rstrip('/')
+ item['name'] = name
item['content_type'] = 'application/directory'
objects[item['name']] = self.client.storage_object(self.container, item['name'], headers=item)
return objects.values()
- return self.client.make_request('GET', [self.container], params=params, formatter=_formatter)
-
+ return self.client.make_request('GET', [self.container], params=params, formatter=_formatter)
+
def is_dir(self):
""" returns True if content_type is 'text/directory' """
return self.model.content_type == 'text/directory'

0 comments on commit fc027e5

Please sign in to comment.