Skip to content

Commit

Permalink
[enrich] Fix empty value of 'author_domain' field
Browse files Browse the repository at this point in the history
This code fixes the empty value of `author_domain` field on the
`refreshing identities` process and sets it to `None`.

Signed-off-by: Quan Zhou <[email protected]>
  • Loading branch information
zhquan committed Jan 26, 2022
1 parent fda45e9 commit a8f3b29
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions grimoire_elk/enriched/enrich.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a8f3b29

Please sign in to comment.