mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-03 15:41:06 -04:00
Get rid of the regex
Regexes are hard to read, and this one is probably quite slow because the string formatting means it can never be precompiled.
This commit is contained in:
@@ -466,9 +466,12 @@ class GovernmentDomain:
|
||||
|
||||
def fn(domain):
|
||||
|
||||
return (email_address_or_domain == domain) or re.search(
|
||||
"[\.|@]({})$".format(domain.replace(".", "\.")),
|
||||
email_address_or_domain
|
||||
return (
|
||||
email_address_or_domain == domain
|
||||
) or (
|
||||
email_address_or_domain.endswith("@{}".format(domain))
|
||||
) or (
|
||||
email_address_or_domain.endswith(".{}".format(domain))
|
||||
)
|
||||
|
||||
return fn
|
||||
|
||||
Reference in New Issue
Block a user