Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Domainban: Take TLDs into account
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger Ostrander authored and chromakode committed Mar 9, 2013
1 parent 1acb235 commit 8730de1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions r2/r2/models/account.py
Expand Up @@ -538,11 +538,11 @@ def which_emails_are_banned(cls, canons):
canons_by_domain[domain].append(canon)

# Now, build a list of subdomains to check for ban status; for
# abc@foo.bar.com, we need to check foo.bar.com and bar.com
# abc@foo.bar.com, we need to check foo.bar.com, bar.com, and .com
canons_by_subdomain = {}
for domain, canons in canons_by_domain.iteritems():
parts = domain.rstrip(".").split(".")
while len(parts) >= 2:
while len(parts) >= 1:
whole = ".".join(parts)
canons_by_subdomain.setdefault(whole, [])
canons_by_subdomain[whole].extend(canons)
Expand Down

0 comments on commit 8730de1

Please sign in to comment.