diff options
| author | Scott Bahling <sbahling@suse.de> | 2018-08-24 20:53:28 +0200 |
|---|---|---|
| committer | Scott Bahling <sbahling@suse.de> | 2018-08-24 20:53:28 +0200 |
| commit | 3a8daa2b7989e8e248fe45265aa5af8007927b31 (patch) | |
| tree | 8c7fab0374a65b3a8b038d499d7cf5ad9f952084 | |
| parent | 5ff1f37d5ec0c924a6e51b374d59ef1e01d830a6 (diff) | |
| download | obsapi-3a8daa2b7989e8e248fe45265aa5af8007927b31.tar.gz obsapi-3a8daa2b7989e8e248fe45265aa5af8007927b31.tar.xz obsapi-3a8daa2b7989e8e248fe45265aa5af8007927b31.zip | |
Enhance api.ls and api.project_ls
Allow listing projects by passing no 'prj' option to api.ls()
| -rw-r--r-- | obsapi/core.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/obsapi/core.py b/obsapi/core.py index 42a478e..49382d1 100644 --- a/obsapi/core.py +++ b/obsapi/core.py @@ -148,14 +148,16 @@ class ObsApi(object): return self.binaries_ls(prj, pkg, repo, arch) if prj and pkg: return self.package_ls(prj, pkg) - if prj: - return self.project_ls(prj) - return None + return self.project_ls(prj) def project_ls(self, prj): xml = self.source.get(prj) - d = etree.fromstring(xml) + + if xml is None: + return [] + + d = self.__xml2etree(xml) lsitems = [e.get('name') for e in d.findall('entry')] return lsitems |
