Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 444d0f8

Browse files
committed
Eric Raymond: added doc for isheader(); improved docs for constructor.
1 parent 1299100 commit 444d0f8

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

Doc/lib/librfc822.tex

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ \section{Standard Module \module{rfc822}}
1818
Instantiation reads headers from the input object up to a delimiter
1919
line (normally a blank line) and stores them in the instance.
2020

21-
If the input object has \code{seek} and \code{tell} methods, the
22-
last action of the class initialization is to try to seek the object
23-
to just before the blank line that terminates the headers.
24-
Otherwise, if the input object has an \code{unread} method, that
25-
method is used to push back the delimiter line.
21+
This class can work with any input object that supports a readline
22+
method. If the input object has seek and tell capability, the
23+
\code{rewindbody} method will work; also, illegal lines will be pushed back
24+
onto the input stream. If the input object lacks seek but has an
25+
\code{unread} method that can push back a line of input, Message will use
26+
that to push back illegal lines. Thus this class can be used to parse
27+
messages coming from a buffered stream.
2628

2729
The optional \code{seekable} argument is provided as a workaround for
2830
certain stdio libraries in which tell() discards buffered data before
@@ -83,10 +85,19 @@ \subsection{Message Objects}
8385
object is seekable.
8486
\end{methoddesc}
8587

88+
\begin{methoddesc}{isheader}{line}
89+
Returns a line's canonicalized fieldname (the dictionary key that will
90+
be used to index it) if the line is a legal RFC822 header; otherwise
91+
returns None (implying that parsing should stop here and the line be
92+
pushed back on the input stream). It is sometimes useful to override
93+
this method in a subclass.
94+
\end{methoddesc}
95+
8696
\begin{methoddesc}{islast}{line}
8797
Return true if the given line is a delimiter on which Message should
88-
stop. By default this method just checks that the line is blank, but
89-
you can override it in a subclass.
98+
stop. The delimiter line is consumed, and the file object's read
99+
location positioned immediately after it. By default this method just
100+
checks that the line is blank, but you can override it in a subclass.
90101
\end{methoddesc}
91102

92103
\begin{methoddesc}{iscomment}{line}

0 commit comments

Comments
 (0)