Skip to content

Commit 5f0d289

Browse files
committed
Too hard, too long.
1 parent 0fb2bc6 commit 5f0d289

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

docs/validate.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,22 @@ with.
309309

310310
Check if the instance is a valid e-mail address.
311311

312-
Checking is based on `RFC 2822`_
313-
314312
>>> is_email("[email protected]")
315313
True
316314
>>> is_email("joe.bloggs")
317315
False
318316

317+
.. note::
318+
319+
This is *not* done in strict compliance of `RFC 2822`_ and / or `RFC
320+
5322`_.
321+
322+
The only constraint is that the instance contain an ``@`` sign. If you
323+
want stricter compliance, either change what you want or add and
324+
register your own checker.
325+
319326
.. _RFC 2822: http://tools.ietf.org/html/rfc2822
327+
.. _RFC 5322: http://tools.ietf.org/html/rfc5322
320328

321329
.. autofunction:: is_host_name
322330

jsonschema.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -550,15 +550,7 @@ def is_uri(instance):
550550

551551
@FormatChecker.cls_checks("email")
552552
def is_email(instance):
553-
pattern = (r"^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_"
554-
r"`{|}~-]+)*|\"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b"
555-
r"\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*\")@(?:(?:[a-z"
556-
r"0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0"
557-
r"-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}"
558-
r"(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9"
559-
r"]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x"
560-
r"01-\x09\x0b\x0c\x0e-\x7f])+)\])$")
561-
return bool(re.match(pattern, instance))
553+
return "@" in instance
562554

563555

564556
@FormatChecker.cls_checks("ip-address")

0 commit comments

Comments
 (0)