def _iterate_files(self, content): files = [] if 'files' in content: for file_info in content['files']: f = DataFile(self.client, pathJoin(self.path, file_info['filename'])) f.set_attributes(file_info) files.append(f) return files
def _iterate_directories(self, content): directories = [] if 'folders' in content: for dir_info in content['folders']: d = DataDirectory(self.client, pathJoin(self.path, dir_info['name'])) d.set_attributes(dir_info) directories.append(d) return directories
def dir(self, name): return DataDirectory(self.client, pathJoin(self.path, name))
def file(self, name): return DataFile(self.client, pathJoin(self.path, name))
def file(self, name): return ModelFile(self.client, pathJoin(self.path, name))
def test_pathJoin(self): self.assertEqual('/a/b/c/d', pathJoin('/a/b/c/', 'd')) self.assertEqual('/a/b/c/d', pathJoin('/a/b/c', 'd')) self.assertEqual('/a//b/c///d', pathJoin('/a//b/c//', '/d'))