mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-18 06:11:58 -05:00
Remove raw string notation
Makes it fiddlier to add new domains, and is only needed to generate the regular expression. Much cleaner to just insert them as part of generating the regular expression.
This commit is contained in:
60
app/utils.py
60
app/utils.py
@@ -439,42 +439,42 @@ class NotGovernmentDomain(Exception):
|
||||
class GovernmentDomain:
|
||||
|
||||
domains = [
|
||||
r"gov\.uk",
|
||||
r"mod\.uk",
|
||||
r"mil\.uk",
|
||||
r"ddc-mod\.org",
|
||||
r"slc\.co\.uk",
|
||||
r"gov\.scot",
|
||||
r"parliament\.uk",
|
||||
r"nhs\.uk",
|
||||
r"nhs\.net",
|
||||
r"police\.uk",
|
||||
r"dclgdatamart\.co\.uk",
|
||||
r"ucds\.email",
|
||||
r"naturalengland\.org\.uk",
|
||||
r"hmcts\.net",
|
||||
r"scotent\.co\.uk",
|
||||
r"assembly\.wales",
|
||||
r"cjsm\.net",
|
||||
r"cqc\.org\.uk",
|
||||
r"bl\.uk",
|
||||
r"stfc\.ac\.uk",
|
||||
r"wmfs\.net",
|
||||
r"bbsrc\.ac\.uk",
|
||||
r"acas\.org\.uk",
|
||||
r"gov\.wales",
|
||||
r"biglotteryfund\.org\.uk",
|
||||
r"marinemanagement\.org\.uk",
|
||||
r"britishmuseum\.org",
|
||||
r"derrystrabane\.com",
|
||||
r"highwaysengland\.co\.uk",
|
||||
"gov.uk",
|
||||
"mod.uk",
|
||||
"mil.uk",
|
||||
"ddc-mod.org",
|
||||
"slc.co.uk",
|
||||
"gov.scot",
|
||||
"parliament.uk",
|
||||
"nhs.uk",
|
||||
"nhs.net",
|
||||
"police.uk",
|
||||
"dclgdatamart.co.uk",
|
||||
"ucds.email",
|
||||
"naturalengland.org.uk",
|
||||
"hmcts.net",
|
||||
"scotent.co.uk",
|
||||
"assembly.wales",
|
||||
"cjsm.net",
|
||||
"cqc.org.uk",
|
||||
"bl.uk",
|
||||
"stfc.ac.uk",
|
||||
"wmfs.net",
|
||||
"bbsrc.ac.uk",
|
||||
"acas.org.uk",
|
||||
"gov.wales",
|
||||
"biglotteryfund.org.uk",
|
||||
"marinemanagement.org.uk",
|
||||
"britishmuseum.org",
|
||||
"derrystrabane.com",
|
||||
"highwaysengland.co.uk",
|
||||
]
|
||||
|
||||
def __init__(self, email_address_or_domain):
|
||||
|
||||
for domain in self.domains:
|
||||
if re.search(
|
||||
r"[\.|@]({})$".format(domain),
|
||||
"[\.|@]({})$".format(domain.replace(".", "\.")),
|
||||
email_address_or_domain.lower()
|
||||
):
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user