Commit dd534bd1 authored by Mike Hoang's avatar Mike Hoang
Browse files

Added cyrillic characters support in email field

parent b3281516
......@@ -267,9 +267,9 @@ class EmailType(StringType):
EMAIL_REGEX = re.compile(r"""^(
( ( [%(atext)s]+ (\.[%(atext)s]+)* ) | ("( [%(qtext)s\s] | \\[%(vchar)s\s] )*") )
@((?!-)[A-Z0-9-]{1,63}(?<!-)\.)+[A-Z]{2,63})$"""
@((?!-)[A-Z0-9А-ЯЁІҐЇЄ-]{1,63}(?<!-)\.)+[A-ZА-ЯЁІҐЇЄ]{2,63})$"""
% {
'atext': '-A-Z0-9!#$%&\'*+/=?^_`{|}~',
'atext': '-A-Z0-9А-ЯЁІҐЇЄ!#$%&\'*+/=?^_`{|}~',
'qtext': '\x21\x23-\x5B\\\x5D-\x7E',
'vchar': '\x21-\x7E'
},
......
......@@ -167,7 +167,9 @@ def test_email_type_with_valid_addresses():
r'"()\\\<>[]:,;@!\"#$%&*+-/=?^_`{}|~.a"@example.org',
u'"foo bar baz"@example.org',
u'Z@foo.zz',
u'123.qwe.asd@foo.bar.baz'
u'123.qwe.asd@foo.bar.baz',
u'КириллицаТест@почта.com',
u'їієґ@пошта.укр',
]
for addr in addrs:
field.validate(addr)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment