diff options
author | 2017-01-22 12:03:03 +0100 | |
---|---|---|
committer | 2017-01-22 12:04:36 +0100 | |
commit | cd3166150bd42dc8b516e2776d4093418b19d423 (patch) | |
tree | 5171a90fd133d995d559cf8583bdc00c7a3e466e | |
parent | frontend: Implement saving of followed maintainers/projects to cookie (diff) | |
download | grumpy-cd3166150bd42dc8b516e2776d4093418b19d423.tar.gz grumpy-cd3166150bd42dc8b516e2776d4093418b19d423.tar.bz2 grumpy-cd3166150bd42dc8b516e2776d4093418b19d423.zip |
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.
-rw-r--r-- | backend/lib/sync.py | 7 |
1 files changed, 6 insertions, 1 deletions
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? |