@@ -62,41 +62,42 @@ \section{Standard Module \sectcode{rfc822}}
6262\end {funcdesc }
6363
6464\subsection {Message Objects }
65+ \label {message-objects }
6566
6667A \class {Message} instance has the following methods:
6768
68- \begin {funcdesc }{rewindbody}{}
69+ \begin {methoddesc }{rewindbody}{}
6970Seek to the start of the message body. This only works if the file
7071object is seekable.
71- \end {funcdesc }
72+ \end {methoddesc }
7273
73- \begin {funcdesc }{getallmatchingheaders}{name}
74+ \begin {methoddesc }{getallmatchingheaders}{name}
7475Return a list of lines consisting of all headers matching
7576\var {name}, if any. Each physical line, whether it is a continuation
7677line or not, is a separate list item. Return the empty list if no
7778header matches \var {name}.
78- \end {funcdesc }
79+ \end {methoddesc }
7980
80- \begin {funcdesc }{getfirstmatchingheader}{name}
81+ \begin {methoddesc }{getfirstmatchingheader}{name}
8182Return a list of lines comprising the first header matching
8283\var {name}, and its continuation line(s), if any. Return \code {None}
8384if there is no header matching \var {name}.
84- \end {funcdesc }
85+ \end {methoddesc }
8586
86- \begin {funcdesc }{getrawheader}{name}
87+ \begin {methoddesc }{getrawheader}{name}
8788Return a single string consisting of the text after the colon in the
8889first header matching \var {name}. This includes leading whitespace,
8990the trailing linefeed, and internal linefeeds and whitespace if there
9091any continuation line(s) were present. Return \code {None} if there is
9192no header matching \var {name}.
92- \end {funcdesc }
93+ \end {methoddesc }
9394
94- \begin {funcdesc }{getheader}{name}
95+ \begin {methoddesc }{getheader}{name}
9596Like \code {getrawheader(\var {name})}, but strip leading and trailing
9697whitespace. Internal whitespace is not stripped.
97- \end {funcdesc }
98+ \end {methoddesc }
9899
99- \begin {funcdesc }{getaddr}{name}
100+ \begin {methoddesc }{getaddr}{name}
100101Return a pair \code {(\var {full name}, \var {email address})} parsed
101102from the string returned by \code {getheader(\var {name})}. If no
102103header matching \var {name} exists, return \code {(None, None)};
@@ -110,9 +111,9 @@ \subsection{Message Objects}
110111If the header contained
111112\code {'Jack Jansen <
[email protected] >'} instead, it would yield the
112113exact same result.
113- \end {funcdesc }
114+ \end {methoddesc }
114115
115- \begin {funcdesc }{getaddrlist}{name}
116+ \begin {methoddesc }{getaddrlist}{name}
116117This is similar to \code {getaddr(\var {list})}, but parses a header
117118containing a list of email addresses (e.g. a \code {To} header) and
118119returns a list of \code {(\var {full name}, \var {email address})} pairs
@@ -121,9 +122,9 @@ \subsection{Message Objects}
121122
122123XXX The current version of this function is not really correct. It
123124yields bogus results if a full name contains a comma.
124- \end {funcdesc }
125+ \end {methoddesc }
125126
126- \begin {funcdesc }{getdate}{name}
127+ \begin {methoddesc }{getdate}{name}
127128Retrieve a header using \method {getheader()} and parse it into a 9-tuple
128129compatible with \function {time.mktime()}. If there is no header matching
129130\var {name}, or it is unparsable, return \code {None}.
@@ -132,32 +133,33 @@ \subsection{Message Objects}
132133the standard. While it has been tested and found correct on a large
133134collection of email from many sources, it is still possible that this
134135function may occasionally yield an incorrect result.
135- \end {funcdesc }
136+ \end {methoddesc }
136137
137- \begin {funcdesc }{getdate_tz}{name}
138+ \begin {methoddesc }{getdate_tz}{name}
138139Retrieve a header using \method {getheader()} and parse it into a
13914010-tuple; the first 9 elements will make a tuple compatible with
140141\function {time.mktime()}, and the 10th is a number giving the offset
141142of the date's timezone from UTC. Similarly to \method {getdate()}, if
142143there is no header matching \var {name}, or it is unparsable, return
143144\code {None}.
144- \end {funcdesc }
145+ \end {methoddesc }
145146
146147\class {Message} instances also support a read-only mapping interface.
147- In particular: \code {\var {m}[name]} is the same as
148- \code {\var {m}.getheader(name)}; and \code {len(\var {m})},
148+ In particular: \code {\var {m}[name]} is like
149+ \code {\var {m}.getheader(name)} but raises \exception {KeyError} if
150+ there is no matching header; and \code {len(\var {m})},
149151\code {\var {m}.has_key(name)}, \code {\var {m}.keys()},
150152\code {\var {m}.values()} and \code {\var {m}.items()} act as expected
151153(and consistently).
152154
153155Finally, \class {Message} instances have two public instance variables:
154156
155- \begin {datadesc }{headers}
157+ \begin {memberdesc }{headers}
156158A list containing the entire set of header lines, in the order in
157159which they were read. Each line contains a trailing newline. The
158160blank line terminating the headers is not contained in the list.
159- \end {datadesc }
161+ \end {memberdesc }
160162
161- \begin {datadesc }{fp}
163+ \begin {memberdesc }{fp}
162164The file object passed at instantiation time.
163- \end {datadesc }
165+ \end {memberdesc }
0 commit comments