Is there a reason for having a backend validation at all?

There is no reliable way to validate an email-address without actually 
sending a message to it.

In my opinion EmailField should use a widget that uses `type="email"` to 
trigger frontend validation.
It may also set a max length for the database column. Nothing more.

Den måndag 14 mars 2016 kl. 19:09:24 UTC+1 skrev Tim Graham:
>
> On a pull request that proposes to tighten the validation of 
> EmailValidator [0], Ned Batchelder questioned the usefulness of this:
>
> "Can I respectfully suggest that continuing to tweak this complex regex to 
> get asymptotically closer to perfection is not worth it? Especially to fix 
> false positives. What real-world problem is happening because "gmail.-com" 
> is accepted? "gmail.ccomm" is also accepted, but is just as useless as an 
> email address."
>
> Collin Anderson proposed:
>
> "I think we should try to just match the standard html <input 
> type="email"> validation. I'd imagine that most uses cases would want to 
> match that. We might be able to use the regex verbatim from the standard 
> itself:
>
> ​
> https://html.spec.whatwg.org/multipage/forms.html#e-mail-state-(type=email
> )
> If people want to allow things outside of that they could use a custom 
> regex.
> Though it gets more complicated when considering Unicode. Unicode needs to 
> get normalized to ascii before running through the official regex."
>
> (Of course, this may be somewhat backwards-incompatible.)
>
> What are your thoughts on this? I don't mind putting a halt to 
> enhancements to the validation as long as we can articulate a sensible 
> policy in the documentation.
>
> [0] https://github.com/django/django/pull/5612
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/b4e1b9d9-c424-438b-a66b-21339bebb702%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to