public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Gilles Dartiguelongue" <eva@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/grumpy:master commit in: backend/lib/
Date: Sun, 22 Jan 2017 12:36:11 +0000 (UTC)	[thread overview]
Message-ID: <1485088558.c71c75d3fbf28528c844f8280e0ef499dacb1819.eva@gentoo> (raw)

commit:     c71c75d3fbf28528c844f8280e0ef499dacb1819
Author:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 22 12:35:58 2017 +0000
Commit:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Sun Jan 22 12:35:58 2017 +0000
URL:        https://gitweb.gentoo.org/proj/grumpy.git/commit/?id=c71c75d3

sync: use dict facilities for key retrieval with a default

 backend/lib/sync.py | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/backend/lib/sync.py b/backend/lib/sync.py
index 723c3af..02e1116 100644
--- a/backend/lib/sync.py
+++ b/backend/lib/sync.py
@@ -176,26 +176,25 @@ def sync_versions():
             package.description = pkg['description']
 
         maintainers = []
-        if 'maintainers' in pkg:
-            for maint in pkg['maintainers']:
-                if 'email' not in maint or 'type' not in maint:
-                    raise ValueError(
-                        "Package %s maintainer %s entry not GLEP 67 valid" %
-                        (package.full_name, maint)
-                    )
-
-                email = maint['email'].lower()
-                if email in existing_maintainers:
-                    maintainers.append(existing_maintainers[email])
-                else:
-                    is_project = False
-                    if maint['type'] == 'project':
-                        is_project = True
-                    print("Adding %s maintainer %s" % ("project" if is_project else "individual", email))
-                    new_maintainer = Maintainer(email=email, is_project=is_project, name=maint.get('name'))
-                    db.session.add(new_maintainer)
-                    existing_maintainers[email] = new_maintainer
-                    maintainers.append(new_maintainer)
+        for maint in pkg.get('maintainers', []):
+            if 'email' not in maint or 'type' not in maint:
+                raise ValueError(
+                    "Package %s maintainer %s entry not GLEP 67 valid" %
+                    (package.full_name, maint)
+                )
+
+            email = maint['email'].lower()
+            if email in existing_maintainers:
+                maintainers.append(existing_maintainers[email])
+            else:
+                is_project = False
+                if maint['type'] == 'project':
+                    is_project = True
+                print("Adding %s maintainer %s" % ("project" if is_project else "individual", email))
+                new_maintainer = Maintainer(email=email, is_project=is_project, name=maint.get('name'))
+                db.session.add(new_maintainer)
+                existing_maintainers[email] = new_maintainer
+                maintainers.append(new_maintainer)
 
         # Intentionally outside if 'maintainers' in pkg, because if there are no maintainers in JSON, it's falled to maintainer-needed and we need to clean out old maintainer entries
         package.maintainers = maintainers # TODO: Retain order to know who is primary; retain description associated with the maintainership


             reply	other threads:[~2017-01-22 12:36 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-22 12:36 Gilles Dartiguelongue [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-01-23  0:06 [gentoo-commits] proj/grumpy:master commit in: backend/lib/ Gilles Dartiguelongue
2017-01-22 17:46 Gilles Dartiguelongue
2017-01-22 17:13 Gilles Dartiguelongue
2017-01-22 12:36 Gilles Dartiguelongue
2017-01-22 12:36 Gilles Dartiguelongue
2017-01-22 12:24 Gilles Dartiguelongue
2017-01-22 12:24 Gilles Dartiguelongue
2017-01-22 12:24 Gilles Dartiguelongue
2017-01-22 12:08 Mart Raudsepp
2017-01-22 12:00 Gilles Dartiguelongue
2017-01-22 12:00 Gilles Dartiguelongue
2017-01-22 11:59 Mart Raudsepp
2017-01-22 11:04 Gilles Dartiguelongue
2017-01-22 11:04 Gilles Dartiguelongue
2016-12-07  7:10 Mart Raudsepp
2016-12-07  4:42 Mart Raudsepp
2016-12-07  2:53 Mart Raudsepp
2016-12-07  2:40 Mart Raudsepp
2016-12-07  2:10 Mart Raudsepp
2016-12-07  1:58 Mart Raudsepp
2016-12-07  1:58 Mart Raudsepp
2016-12-07  0:34 Mart Raudsepp
2016-12-05 17:46 Mart Raudsepp
2016-12-04  8:04 Mart Raudsepp
2016-12-04  8:04 Mart Raudsepp
2016-12-04  7:44 Mart Raudsepp
2016-12-04  6:27 Mart Raudsepp
2016-12-04  6:27 Mart Raudsepp
2016-12-04  5:26 Mart Raudsepp
2016-12-04  5:26 Mart Raudsepp
2016-12-04  4:56 Mart Raudsepp
2016-11-11  1:22 Mart Raudsepp
2016-11-10 15:50 Mart Raudsepp
2016-09-24  7:02 Mart Raudsepp
2016-09-07 20:21 Mart Raudsepp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1485088558.c71c75d3fbf28528c844f8280e0ef499dacb1819.eva@gentoo \
    --to=eva@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox