commit: 5f53c4b92b93e9206089a15ff3851925ed3b8952 Author: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org> AuthorDate: Sun Jan 22 11:04:12 2017 +0000 Commit: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org> CommitDate: Sun Jan 22 11:04:40 2017 +0000 URL: https://gitweb.gentoo.org/proj/grumpy.git/commit/?id=5f53c4b9
sync: use dict-comprehension in sync_packages 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 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