]> khamidou — GitHub mirrors - flanker.git/commitdiff
Made the display-name more relaxed, now allows you to have periods
authorRussell Jones <rjones@mailgunhq.com>
Wed, 30 Oct 2013 03:20:14 +0000 (20:20 -0700)
committerRussell Jones <rjones@mailgunhq.com>
Wed, 30 Oct 2013 03:20:14 +0000 (20:20 -0700)
outside of qstrings. Violates RFC, but more conformant with what we
see in the wild.

flanker/addresslib/tokenizer.py

index 2d371772ef5f547cdbd92396ffcdc7c3b401f34c..08e568314371a09b46ea87bf5daa799def99c30e 100644 (file)
@@ -34,8 +34,16 @@ UNI_WHITE  = re.compile(ur'''
                         ]*
                         ''', re.MULTILINE | re.VERBOSE | re.UNICODE)
 
+# because we only use an atom in display-names, we've included a dot (.) which
+# is normally not part of an atom. this allows us to be a little more relaxed
+# in display-name parsing.
 ATOM       = re.compile(r'''
+                        [A-Za-z0-9\.!#$%&'*+\-/=?^_`{|}~]+        # atext
+                        ''', re.MULTILINE | re.VERBOSE)
+
+DOT_ATOM   = re.compile(r'''
                         [A-Za-z0-9!#$%&'*+\-/=?^_`{|}~]+        # atext
+                        (\.[A-Za-z0-9!#$%&'*+\-/=?^_`{|}~]+)*   # (dot atext)*
                         ''', re.MULTILINE | re.VERBOSE)
 
 UNI_ATOM   = re.compile(ur'''
@@ -97,11 +105,6 @@ UNI_QSTR   = re.compile(ur'''
                         "
                         ''', re.MULTILINE | re.VERBOSE | re.UNICODE)
 
-DOT_ATOM   = re.compile(r'''
-                        [A-Za-z0-9!#$%&'*+\-/=?^_`{|}~]+        # atext
-                        (\.[A-Za-z0-9!#$%&'*+\-/=?^_`{|}~]+)*   # (dot atext)*
-                        ''', re.MULTILINE | re.VERBOSE)
-
 QSTRING    = re.compile(r'''
                         "                                       # dquote
                         (\s*                                    # whitespace