django-blob_7.py 555 B

12345678910111213141516171819202122
  1. def listdir(self, path):
  2. """
  3. Lists the contents of the specified path, returning a 2-tuple of lists;
  4. the first item being directories, the second item being files.
  5. """
  6. files = []
  7. if path and not path.endswith('/'):
  8. path = '%s/' % path
  9. path_len = len(path)
  10. if not path:
  11. path = None
  12. blob_list = self._get_service().list_blobs(self.container, prefix=path)
  13. for name in blob_list:
  14. files.append(name[path_len:])
  15. return ([], files)