New submission from cd34 <rep...@daviesinc.com>:

line 249, colander/__init__.py

        super(Email, self).__init__(
            u'(?i)^[a-z0-9._%+...@[a-z0-9.-]+\.[a-z]{2,4}$', msg=msg)

the regexp has a number of issues.  First, tlds can be longer than 4 
characters, 
i.e. .museum.

FormEncode splits on the @ and validates the username and domain portion 
separately and does properly do the domain handling, but, the username portion 
still has issues.  A quick fix would be to append the DomainRE from FormEncode 
with the existing userside regexp from the current code.

FormEncode's regexp from formencode/validators.py:

    usernameRE = re.compile(r"^[^ \t\n\r@<>()]+$", re.I)
    domainRE = re.compile(r'''
        ^(?:[a-z0-9][a-z0-9\-]{0,62}\.)+ # (sub)domain - alpha followed by 
62max 
chars (63 total)
        [a-z]{2,}$                       # TLD
    ''', re.I | re.VERBOSE)

(I couldn't find a place to report bugs for deform/colander in the topics.  As 
project didn't seem to match any existing repoze.*, I'm hoping it is a catchall)

----------
messages: 465
nosy: cd34
priority: bug
status: unread
title: Colander Email Regexp breaks in a few cases
topic: repoze.project

__________________________________
Repoze Bugs <b...@bugs.repoze.org>
<http://bugs.repoze.org/issue172>
__________________________________
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to