From ac2bce9dca4e33e2f8393227d09bba8d14840234 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 20 2015 08:53:36 +0000 Subject: Handle when we cannot get the username nor emails from the JSON blob In such case, we can just assume there was no user set in the given JSON blob and with the given key --- diff --git a/pagure/lib/git.py b/pagure/lib/git.py index 0d8bcb8..374fdca 100644 --- a/pagure/lib/git.py +++ b/pagure/lib/git.py @@ -215,6 +215,9 @@ def get_user_from_json(session, jsondata, key='user'): fullname = jsondata.get(key, {}).get('fullname') useremails = jsondata.get(key, {}).get('emails') default_email = jsondata.get(key, {}).get('default_email') + if not username and not useremails: + return + user = pagure.lib.search_user(session, username=username) if not user: for email in useremails: