def load_path_list(self): """ Loads a list of artifact paths from the cloud. This does NOT include metadata or special private data. Returns: List(basestring) """ with self.bucket_container.create_cloud_storage() as storage: artifact_list = storage.get_directory_contents("", True) path_list = filters.to_path_list(artifact_list) path_list = filters.directories(path_list) path_list = filters.all_private(path_list) return path_list
def test_all_private(self): path_list = [ "/sup/_man", "/blah/hello", "_keys/kyle", "/this/one/fine", "/blah/_metadata_20", ] expected_list = [ "/blah/hello", "/this/one/fine", ] filtered_path_list = akfilter.all_private(path_list) self.assertEqual(expected_list, filtered_path_list)
def assign_listing(self, path_list): """ Builds list of links and assigns it to pyshelf.context.Context.link_list Args: path_list(List(string)): List of cloud paths. """ artifact_path_list = filters.all_private(path_list) for artifact_path in artifact_path_list: resource_path = self.path_converter.from_cloud(artifact_path) rel_type = "item" title = "artifact" if resource_path[-1] == "/": rel_type = "collection" title = "a collection of artifacts" self._add_link(resource_path, rel_type, title)
def assign_listing(self, path_list): """ Builds list of links and assigns it to pyshelf.context.Context.link_list Args: path_list(List(string)): List of cloud paths. """ artifact_path_list = filters.all_private(path_list) for artifact_path in artifact_path_list: resource_path = self.path_converter.from_cloud(artifact_path) rel_type = "item" title = "artifact" if resource_path[-1] == "/": rel_type = "collection" title = "a collection of artifacts" if resource_path == self.request.path: rel_type = "self" self._add_link(resource_path, rel_type, title)