Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

StorageObject.list() to use prefix #4

Merged
merged 2 commits into from

1 participant

@sudorandom
Collaborator

Changed the StorageObject to use the prefix parameter instead of path. Also updated the minor version because this might break compatibility.

@sudorandom sudorandom merged commit fc027e5 into softlayer:master
sudorandom added some commits
@sudorandom sudorandom StorageObject.list() to use prefix
Changed the StorageObject to use the prefix parameter instead of path.
612d3ea
@sudorandom sudorandom Minor Version Bump 9223c9a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 16, 2012
  1. @sudorandom

    StorageObject.list() to use prefix

    sudorandom authored
    Changed the StorageObject to use the prefix parameter instead of path.
  2. @sudorandom

    Minor Version Bump

    sudorandom authored
This page is out of date. Refresh to see the latest.
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'
Something went wrong with that request. Please try again.