commit: cd3166150bd42dc8b516e2776d4093418b19d423
Author: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 22 11:03:03 2017 +0000
Commit: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Sun Jan 22 11:04:36 2017 +0000
URL: https://gitweb.gentoo.org/proj/grumpy.git/commit/?id=cd316615
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?