Commit 23329d41 authored by Fred Drake's avatar Fred Drake

Some logical markup, some nits.

parent 20392ccb
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
\modulesynopsis{Parse \rfc{822} style mail headers.} \modulesynopsis{Parse \rfc{822} style mail headers.}
%\index{RFC!RFC 822}
This module defines a class, \class{Message}, which represents a This module defines a class, \class{Message}, which represents a
collection of ``email headers'' as defined by the Internet standard collection of ``email headers'' as defined by the Internet standard
\rfc{822}. It is used in various contexts, usually to read such \rfc{822}. It is used in various contexts, usually to read such
...@@ -17,38 +15,41 @@ style mailbox files: \module{mailbox}\refstmodindex{mailbox}. ...@@ -17,38 +15,41 @@ style mailbox files: \module{mailbox}\refstmodindex{mailbox}.
\begin{classdesc}{Message}{file\optional{, seekable}} \begin{classdesc}{Message}{file\optional{, seekable}}
A \class{Message} instance is instantiated with an input object as A \class{Message} instance is instantiated with an input object as
parameter. Message relies only on the input object having a parameter. Message relies only on the input object having a
\code{readline} method; in particular, ordinary file objects qualify. \method{readline()} method; in particular, ordinary file objects
Instantiation reads headers from the input object up to a delimiter qualify. Instantiation reads headers from the input object up to a
line (normally a blank line) and stores them in the instance. delimiter line (normally a blank line) and stores them in the
instance.
This class can work with any input object that supports a readline
method. If the input object has seek and tell capability, the This class can work with any input object that supports a
\code{rewindbody} method will work; also, illegal lines will be pushed back \method{readline()} method. If the input object has seek and tell
onto the input stream. If the input object lacks seek but has an capability, the \method{rewindbody()} method will work; also, illegal
\code{unread} method that can push back a line of input, Message will use lines will be pushed back onto the input stream. If the input object
that to push back illegal lines. Thus this class can be used to parse lacks seek but has an \method{unread()} method that can push back a
messages coming from a buffered stream. line of input, \class{Message} will use that to push back illegal
lines. Thus this class can be used to parse messages coming from a
The optional \code{seekable} argument is provided as a workaround for buffered stream.
certain stdio libraries in which tell() discards buffered data before
discovering that the \code{lseek()} system call doesn't work. For The optional \var{seekable} argument is provided as a workaround for
maximum portability, you should set the seekable argument to zero to certain stdio libraries in which \cfunction{tell()} discards buffered
prevent that initial \code{tell} when passing in an unseekable object data before discovering that the \cfunction{lseek()} system call
such as a a file object created from a socket object. doesn't work. For maximum portability, you should set the seekable
argument to zero to prevent that initial \method{tell()} when passing
in an unseekable object such as a a file object created from a socket
object.
Input lines as read from the file may either be terminated by CR-LF or Input lines as read from the file may either be terminated by CR-LF or
by a single linefeed; a terminating CR-LF is replaced by a single by a single linefeed; a terminating CR-LF is replaced by a single
linefeed before the line is stored. linefeed before the line is stored.
All header matching is done independent of upper or lower case; All header matching is done independent of upper or lower case;
e.g. \code{\var{m}['From']}, \code{\var{m}['from']} and e.g.\ \code{\var{m}['From']}, \code{\var{m}['from']} and
\code{\var{m}['FROM']} all yield the same result. \code{\var{m}['FROM']} all yield the same result.
\end{classdesc} \end{classdesc}
\begin{classdesc}{AddressList}{field} \begin{classdesc}{AddressList}{field}
You may instantiate the AddresssList helper class using a single You may instantiate the AddresssList helper class using a single
string parameter, a comma-separated list of RFC822 addresses to be string parameter, a comma-separated list of \rfc{822} addresses to be
parsed. (The parameter None yields an empty list.) parsed. (The parameter \code{None} yields an empty list.)
\end{classdesc} \end{classdesc}
\begin{funcdesc}{parsedate}{date} \begin{funcdesc}{parsedate}{date}
...@@ -144,7 +145,7 @@ be returned when there is no header matching \var{name}. ...@@ -144,7 +145,7 @@ be returned when there is no header matching \var{name}.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{get}{name\optional{, default}} \begin{methoddesc}{get}{name\optional{, default}}
An alias for \code{getheader()}, to make the interface more compatible An alias for \method{getheader()}, to make the interface more compatible
with regular dictionaries. with regular dictionaries.
\end{methoddesc} \end{methoddesc}
...@@ -166,7 +167,7 @@ exact same result. ...@@ -166,7 +167,7 @@ exact same result.
\begin{methoddesc}{getaddrlist}{name} \begin{methoddesc}{getaddrlist}{name}
This is similar to \code{getaddr(\var{list})}, but parses a header This is similar to \code{getaddr(\var{list})}, but parses a header
containing a list of email addresses (e.g. a \code{To} header) and containing a list of email addresses (e.g.\ a \code{To} header) and
returns a list of \code{(\var{full name}, \var{email address})} pairs returns a list of \code{(\var{full name}, \var{email address})} pairs
(even if there was only one address in the header). If there is no (even if there was only one address in the header). If there is no
header matching \var{name}, return an empty list. header matching \var{name}, return an empty list.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment