diff --git a/grimoire_elk/enriched/enrich.py b/grimoire_elk/enriched/enrich.py index 8c6bdeb5c..f8589b869 100644 --- a/grimoire_elk/enriched/enrich.py +++ b/grimoire_elk/enriched/enrich.py @@ -447,7 +447,7 @@ def get_email_domain(self, email): domain = None try: domain = email.split("@")[1] - except IndexError: + except (IndexError, AttributeError): # logger.warning("Bad email format: %s" % (identity['email'])) pass return domain @@ -801,8 +801,7 @@ def get_item_sh_fields(self, identity=None, item_date=None, sh_id=None, eitem_sh[rol + "_name"] = profile.get('name', eitem_sh[rol + "_name"]) email = profile.get('email', None) - if email: - eitem_sh[rol + "_domain"] = self.get_email_domain(email) + eitem_sh[rol + "_domain"] = self.get_email_domain(email) eitem_sh[rol + "_gender"] = profile.get('gender', self.unknown_gender) eitem_sh[rol + "_gender_acc"] = profile.get('gender_acc', 0)