From: Russell Jones Date: Wed, 30 Oct 2013 03:20:14 +0000 (-0700) Subject: Made the display-name more relaxed, now allows you to have periods X-Git-Tag: v0.1~5 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=ca3c9c8dd023982e092b77b0159f3a6b963ed47b;p=flanker.git Made the display-name more relaxed, now allows you to have periods outside of qstrings. Violates RFC, but more conformant with what we see in the wild. --- diff --git a/flanker/addresslib/tokenizer.py b/flanker/addresslib/tokenizer.py index 2d37177..08e5683 100644 --- a/flanker/addresslib/tokenizer.py +++ b/flanker/addresslib/tokenizer.py @@ -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