@@ -3,8 +3,6 @@ \section{Standard Module \module{rfc822}}
33
44\modulesynopsis {Parse \rfc {822} style mail headers.}
55
6- % \index{RFC!RFC 822}
7-
86This module defines a class, \class {Message}, which represents a
97collection of `` email headers'' as defined by the Internet standard
108\rfc {822}. It is used in various contexts, usually to read such
@@ -17,38 +15,41 @@ \section{Standard Module \module{rfc822}}
1715\begin {classdesc }{Message}{file\optional {, seekable}}
1816A \class {Message} instance is instantiated with an input object as
1917parameter. Message relies only on the input object having a
20- \code {readline} method; in particular, ordinary file objects qualify.
21- Instantiation reads headers from the input object up to a delimiter
22- line (normally a blank line) and stores them in the instance.
23-
24- This class can work with any input object that supports a readline
25- method. If the input object has seek and tell capability, the
26- \code {rewindbody} method will work; also, illegal lines will be pushed back
27- onto the input stream. If the input object lacks seek but has an
28- \code {unread} method that can push back a line of input, Message will use
29- that to push back illegal lines. Thus this class can be used to parse
30- messages coming from a buffered stream.
31-
32- The optional \code {seekable} argument is provided as a workaround for
33- certain stdio libraries in which tell() discards buffered data before
34- discovering that the \code {lseek()} system call doesn't work. For
35- maximum portability, you should set the seekable argument to zero to
36- prevent that initial \code {tell} when passing in an unseekable object
37- such as a a file object created from a socket object.
18+ \method {readline()} method; in particular, ordinary file objects
19+ qualify. Instantiation reads headers from the input object up to a
20+ delimiter line (normally a blank line) and stores them in the
21+ instance.
22+
23+ This class can work with any input object that supports a
24+ \method {readline()} method. If the input object has seek and tell
25+ capability, the \method {rewindbody()} method will work; also, illegal
26+ lines will be pushed back onto the input stream. If the input object
27+ lacks seek but has an \method {unread()} method that can push back a
28+ line of input, \class {Message} will use that to push back illegal
29+ lines. Thus this class can be used to parse messages coming from a
30+ buffered stream.
31+
32+ The optional \var {seekable} argument is provided as a workaround for
33+ certain stdio libraries in which \cfunction {tell()} discards buffered
34+ data before discovering that the \cfunction {lseek()} system call
35+ doesn't work. For maximum portability, you should set the seekable
36+ argument to zero to prevent that initial \method {tell()} when passing
37+ in an unseekable object such as a a file object created from a socket
38+ object.
3839
3940Input lines as read from the file may either be terminated by CR-LF or
4041by a single linefeed; a terminating CR-LF is replaced by a single
4142linefeed before the line is stored.
4243
4344All header matching is done independent of upper or lower case;
44- e.g. \code {\var {m}['From']}, \code {\var {m}['from']} and
45+ e.g.\ \code {\var {m}['From']}, \code {\var {m}['from']} and
4546\code {\var {m}['FROM']} all yield the same result.
4647\end {classdesc }
4748
4849\begin {classdesc }{AddressList}{field}
4950You may instantiate the AddresssList helper class using a single
50- string parameter, a comma-separated list of RFC822 addresses to be
51- parsed. (The parameter None yields an empty list.)
51+ string parameter, a comma-separated list of \rfc {822} addresses to be
52+ parsed. (The parameter \code { None} yields an empty list.)
5253\end {classdesc }
5354
5455\begin {funcdesc }{parsedate}{date}
@@ -144,7 +145,7 @@ \subsection{Message Objects}
144145\end {methoddesc }
145146
146147\begin {methoddesc }{get}{name\optional {, default}}
147- An alias for \code {getheader()}, to make the interface more compatible
148+ An alias for \method {getheader()}, to make the interface more compatible
148149with regular dictionaries.
149150\end {methoddesc }
150151
@@ -166,7 +167,7 @@ \subsection{Message Objects}
166167
167168\begin {methoddesc }{getaddrlist}{name}
168169This is similar to \code {getaddr(\var {list})}, but parses a header
169- containing a list of email addresses (e.g. a \code {To} header) and
170+ containing a list of email addresses (e.g.\ a \code {To} header) and
170171returns a list of \code {(\var {full name}, \var {email address})} pairs
171172(even if there was only one address in the header). If there is no
172173header matching \var {name}, return an empty list.
0 commit comments