diff options
author | Guido van Rossum <guido@python.org> | 1998-06-11 13:50:02 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-06-11 13:50:02 (GMT) |
commit | 444d0f87c9e4de5082a92c658cc36843855b23b9 (patch) | |
tree | cf4850fefc1e06db2b377fcd2abbe740d4f92fc2 | |
parent | 1299100324f20f59c3a010d0e665e3f085d3e354 (diff) | |
download | cpython-444d0f87c9e4de5082a92c658cc36843855b23b9.zip cpython-444d0f87c9e4de5082a92c658cc36843855b23b9.tar.gz cpython-444d0f87c9e4de5082a92c658cc36843855b23b9.tar.bz2 |
Eric Raymond: added doc for isheader(); improved docs for constructor.
-rw-r--r-- | Doc/lib/librfc822.tex | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/Doc/lib/librfc822.tex b/Doc/lib/librfc822.tex index b65f18e..d97e0f3 100644 --- a/Doc/lib/librfc822.tex +++ b/Doc/lib/librfc822.tex @@ -18,11 +18,13 @@ parameter. Message relies only on the input object having a Instantiation reads headers from the input object up to a delimiter line (normally a blank line) and stores them in the instance. -If the input object has \code{seek} and \code{tell} methods, the -last action of the class initialization is to try to seek the object -to just before the blank line that terminates the headers. -Otherwise, if the input object has an \code{unread} method, that -method is used to push back the delimiter line. +This class can work with any input object that supports a readline +method. If the input object has seek and tell capability, the +\code{rewindbody} method will work; also, illegal lines will be pushed back +onto the input stream. If the input object lacks seek but has an +\code{unread} method that can push back a line of input, Message will use +that to push back illegal lines. Thus this class can be used to parse +messages coming from a buffered stream. The optional \code{seekable} argument is provided as a workaround for certain stdio libraries in which tell() discards buffered data before @@ -83,10 +85,19 @@ Seek to the start of the message body. This only works if the file object is seekable. \end{methoddesc} +\begin{methoddesc}{isheader}{line} +Returns a line's canonicalized fieldname (the dictionary key that will +be used to index it) if the line is a legal RFC822 header; otherwise +returns None (implying that parsing should stop here and the line be +pushed back on the input stream). It is sometimes useful to override +this method in a subclass. +\end{methoddesc} + \begin{methoddesc}{islast}{line} Return true if the given line is a delimiter on which Message should -stop. By default this method just checks that the line is blank, but -you can override it in a subclass. +stop. The delimiter line is consumed, and the file object's read +location positioned immediately after it. By default this method just +checks that the line is blank, but you can override it in a subclass. \end{methoddesc} \begin{methoddesc}{iscomment}{line} |