From cd3166150bd42dc8b516e2776d4093418b19d423 Mon Sep 17 00:00:00 2001 From: Gilles Dartiguelongue Date: Sun, 22 Jan 2017 12:03:03 +0100 Subject: sync: fix broken sync_packages I think there is a problem in the logic here but at least this gets me past the initial sync. --- backend/lib/sync.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/lib/sync.py b/backend/lib/sync.py index 744811b..48629cc 100644 --- a/backend/lib/sync.py +++ b/backend/lib/sync.py @@ -131,7 +131,12 @@ def sync_categories(): def sync_packages(): for category in Category.query.all(): - existing_packages = category.packages.all() + if not category.packages: + print('Category %s has no packages' % category.name) + existing_packages = [] + else: + existing_packages = category.packages.all() + data = http_session.get(pkg_url_base + "categories/" + category.name + ".json") if not data: print("No JSON data for category %s" % category.name) # FIXME: Better handling; mark category as inactive/gone? -- cgit v1.2.3-65-gdbad