From 3a8daa2b7989e8e248fe45265aa5af8007927b31 Mon Sep 17 00:00:00 2001 From: Scott Bahling Date: Fri, 24 Aug 2018 20:53:28 +0200 Subject: Enhance api.ls and api.project_ls Allow listing projects by passing no 'prj' option to api.ls() --- obsapi/core.py | 10 ++++++---- 1 file 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 -- cgit v1.2.3