Agreed that it's too restrictive. FWIW we have been using this in
production. It was based on careful checking of the various RFCs
(though I've just noticed it should also restrict the domain name to
255 characters):
_email_rgx = re.compile(r'^([A-Za-z0-9!#$%&\'*+-/=?^_`{|}~][A-Za-z0-9!#$%&\'*+-/
=?^_`{|}~\.]{0,63}|"[^(\|")]{0,62}")@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+$')
Seb
On 20/10/06, yuppie <[EMAIL PROTECTED]> wrote:
Hi!
At the end of RegistrationTool.py is _checkEmail, a function for
validating email addresses:
http://svn.zope.org/CMF/trunk/CMFDefault/RegistrationTool.py?rev=70840&view=markup
AFAICS the checks performed by that function are too restrictive. These
are the tests I don't agree with:
Test a: characters allowed on local-part: 0-9a-Z-._+'
-----------------------------------------------------
RFC 2822 allows a dot-atom with these characters:
a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~
At least all these characters should be allowed, even more characters
are valid within quoted-strings.
Test b: must start or end with alpha or num
-------------------------------------------
Why? Can we remove that test?
Test c: local-part must end with alpha or num or _
--------------------------------------------------
Why? Can we remove that test?
Test e and f: pairs of '.', '-' and '_' not allowed
---------------------------------------------------
Why in local-part? Can we limit this to the domain part?
Test g: domain must end with '.' plus 2, 3 or 4 alpha
-----------------------------------------------------
There are new TLDs like '.museum' with more than 4 characters. Do we
need this test?
Please let me know if you think I'm missing something. I'd like to fix
these issues and move the code to CMFDefault.utils.
Cheers,
Yuppie
_______________________________________________
Zope-CMF maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope-cmf
See http://collector.zope.org/CMF for bug reports and feature requests
--
--
[] j a m k i t
web solutions for charities
seb bacon
T: 020 7549 0520
F: 020 7549 0505
M: 07968 301 336
W: www.jamkit.com
_______________________________________________
Zope-CMF maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope-cmf
See http://collector.zope.org/CMF for bug reports and feature requests