-
Notifications
You must be signed in to change notification settings - Fork 115
Validation concessions options for top-level domains #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thanks. I feel strongly about not having an option to completely disable the special use domains check: It should not be easy to have non-deliverable addresses pass validation. Is modifying the global SPECIAL_USE_DOMAIN_NAMES list not helpful for your use case? |
Yep, maybe I can do smth like |
This isn't a democracy. :) My goal is to make a good library. It's not to solve any problem that anyone happens to post here. If you can describe why you want these things, it can shape my thinking about what makes a good library for the purpose here. |
No problems. I made some utils for a legacy private infrastructure with TLD like |
On the |
Codecov Report
@@ Coverage Diff @@
## main #86 +/- ##
==========================================
+ Coverage 83.90% 85.43% +1.52%
==========================================
Files 1 1
Lines 261 302 +41
==========================================
+ Hits 219 258 +39
- Misses 42 44 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Yep, that's good! This for d in SPECIAL_USE_DOMAIN_NAMES:
# See the note near the definition of SPECIAL_USE_DOMAIN_NAMES.
if d == "test" and test_environment:
continue
if ascii_domain == d or ascii_domain.endswith("." + d):
raise EmailSyntaxError("The domain name %s is a special-use or reserved name that cannot be used with email." % domain_i18n) under the I hope I'll able to add |
1c0390b
to
d6a5d4b
Compare
5c9973d
to
f18da74
Compare
0df8b7a
to
dbf4618
Compare
Added some specific args for validate_email and validate_email_domain_part methods to give an ability for validating "bad" TLD in email addresses. Full description was added in README
allow_special_domains=False
- ignore restrictions for SPECIAL_USE domainsallow_any_top_level_domain=False
- ignore regex constraints for a TLDallowed_top_level_domains=[]
- whitelist for TLD, not matching regex from previous optionAll tests passed
Default values were set such as
False
for saving the original validation logic without slowdown