• Barry Warsaw's avatar
    Fix address parsing to be RFC 2822 conformant. Specifically, dots are · 9ec58aae
    Barry Warsaw yazdı
    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).
    9ec58aae
rfc822.py 32.1 KB