From 8c264ac120faebd8463f9b6fadde65f40df2ddb0 Mon Sep 17 00:00:00 2001 From: Mart Raudsepp Date: Mon, 5 Dec 2016 19:44:25 +0200 Subject: 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 subtag <%s>" % proj_elem.tag) -- cgit v1.2.3-65-gdbad