commit: 8c264ac120faebd8463f9b6fadde65f40df2ddb0 Author: Mart Raudsepp <leio <AT> gentoo <DOT> org> AuthorDate: Mon Dec 5 17:44:25 2016 +0000 Commit: Mart Raudsepp <leio <AT> gentoo <DOT> org> CommitDate: Mon Dec 5 17:44:25 2016 +0000 URL: https://gitweb.gentoo.org/proj/grumpy.git/commit/?id=8c264ac1
sync: return empty dict on projects retrieval error, so the caller won't error backend/lib/sync.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/lib/sync.py b/backend/lib/sync.py index 2d6244c..e53fa9b 100644 --- a/backend/lib/sync.py +++ b/backend/lib/sync.py @@ -8,16 +8,16 @@ pkg_url_base = "https://packages.gentoo.org/" http_session = requests.session() def get_project_data(): + projects = {} data = http_session.get(proj_url) if not data: print("Failed retrieving projects.xml") - return + return projects root = ET.fromstring(data.content) - projects = {} # Parsing is based on http://www.gentoo.org/dtd/projects.dtd as of 2016-11-10 if root.tag.lower() != 'projects': print("Downloaded projects.xml root tag isn't 'projects'") - return + return projects for proj_elem in root: if proj_elem.tag.lower() != 'project': print("Skipping unknown <projects> subtag <%s>" % proj_elem.tag)