]> granicus.if.org Git - python/commit
Fix address parsing to be RFC 2822 conformant. Specifically, dots are
authorBarry Warsaw <barry@python.org>
Mon, 16 Jul 2001 20:40:35 +0000 (20:40 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 16 Jul 2001 20:40:35 +0000 (20:40 +0000)
commit9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7
treee688018560ec8fafbcaf10e8eafc1bbaa2887f16
parent84c10b13bbeaccf154ad42aaa95e9d67e45ca821
Fix address parsing to be RFC 2822 conformant.  Specifically, dots are
now allowed in unquoted RealName areas (technically, they are defined
as "obsolete syntax" we MUST accept in phrases, as part of the
obs-phrase production).  Thus, parsing

    To: User J. Person <person@dom.ain>

correctly returns "User J. Person" as the RealName.

AddrlistClass.__init__(): Add definition of self.phraseends which is
just self.atomends with `.' removed.

getatom(): Add an optional argument `atomends' which, if None (the
default) means use self.atomends.

getphraselist(): Pass self.phraseends to getatom() and break out of
the loop only when the current character is in phraseends instead of
atomends.  This allows dots to continue to serve as atom delimiters in
all contexts except phrases.

Also, loads of docstring updates to document RFC 2822 conformance
(sorry, this should have been two separate patches).
Lib/rfc822.py