policies/email.py: do not return empty email addresses

master
Brian Murray 6 months ago
parent 5cad435a0b
commit e689f9eeac

@ -154,6 +154,8 @@ class EmailPolicy(BasePolicy, Rest):
if match: if match:
addresses.append(match.group(1)) addresses.append(match.group(1))
address = self.addresses[person] = address_chooser(addresses) address = self.addresses[person] = address_chooser(addresses)
if not address:
return None
return address return address
except HTTPError as e: except HTTPError as e:
if e.code != 410: # suspended user if e.code != 410: # suspended user
@ -166,6 +168,8 @@ class EmailPolicy(BasePolicy, Rest):
def scrape_gpg_emails(self, people): def scrape_gpg_emails(self, people):
"""Find email addresses from GPG keys.""" """Find email addresses from GPG keys."""
emails = [self._scrape_gpg_emails(person) for person in (people or [])] emails = [self._scrape_gpg_emails(person) for person in (people or [])]
if not emails:
return
return [email for email in emails if email is not None] return [email for email in emails if email is not None]
def lp_get_emails(self, pkg, version): def lp_get_emails(self, pkg, version):

Loading…
Cancel
Save