aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Dartiguelongue <eva@gentoo.org>2017-01-22 12:04:12 +0100
committerGilles Dartiguelongue <eva@gentoo.org>2017-01-22 12:04:40 +0100
commit5f53c4b92b93e9206089a15ff3851925ed3b8952 (patch)
tree0015ec7bfcff87ffa012137ad1eb300baa422e30
parentsync: fix broken sync_packages (diff)
downloadgrumpy-5f53c4b92b93e9206089a15ff3851925ed3b8952.tar.gz
grumpy-5f53c4b92b93e9206089a15ff3851925ed3b8952.tar.bz2
grumpy-5f53c4b92b93e9206089a15ff3851925ed3b8952.zip
sync: use dict-comprehension in sync_packages
-rw-r--r--backend/lib/sync.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/backend/lib/sync.py b/backend/lib/sync.py
index 48629cc..d292291 100644
--- a/backend/lib/sync.py
+++ b/backend/lib/sync.py
@@ -143,9 +143,9 @@ def sync_packages():
continue
packages = data.json()['packages']
# TODO: Use UPSERT instead (on_conflict_do_update)
- existing_packages = {}
- for pkg in Package.query.all():
- existing_packages[pkg.name] = pkg
+
+ existing_packages = {pkg.name: pkg for pkg in Package.query.all()}
+
for package in packages:
if package['name'] in existing_packages:
continue # TODO: Update description once we keep that in DB