File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -309,14 +309,22 @@ with.
309
309
310
310
Check if the instance is a valid e-mail address.
311
311
312
- Checking is based on `RFC 2822 `_
313
-
314
312
315
313
True
316
314
>>> is_email(" joe.bloggs" )
317
315
False
318
316
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
+
319
326
.. _RFC 2822 : http://tools.ietf.org/html/rfc2822
327
+ .. _RFC 5322 : http://tools.ietf.org/html/rfc5322
320
328
321
329
.. autofunction :: is_host_name
322
330
Original file line number Diff line number Diff line change @@ -550,15 +550,7 @@ def is_uri(instance):
550
550
551
551
@FormatChecker .cls_checks ("email" )
552
552
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
562
554
563
555
564
556
@FormatChecker .cls_checks ("ip-address" )
You can’t perform that action at this time.
0 commit comments