From 5c8264e4283f43fd7a664e8e2741626d710e1926 Mon Sep 17 00:00:00 2001 From: Michael Rollins Date: Mon, 6 May 2019 20:13:42 -0500 Subject: [PATCH] #115: added handler for sync bill error --- src/influencetx/openstates/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/influencetx/openstates/utils.py b/src/influencetx/openstates/utils.py index e878a0e..d3be037 100644 --- a/src/influencetx/openstates/utils.py +++ b/src/influencetx/openstates/utils.py @@ -141,6 +141,7 @@ def deserialize_subject_tags(subject_list): ] def find_legislator_by_last_name(chamber, name): + # LOG.warn(f"Finding Legislator: {name}, in {chamber}") try: legislator = Legislator.objects.get( chamber=chamber, @@ -154,7 +155,10 @@ def find_legislator_by_last_name(chamber, name): ) except: legislator = None - + except Legislator.MultipleObjectsReturned: + legislator = None + LOG.warn(f"too many: {name}, in {chamber}") + return legislator