Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
12991003
Commit
12991003
authored
Jun 10, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document the changes I just checked in.
parent
c7bb8577
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
8 deletions
+39
-8
Doc/lib/librfc822.tex
Doc/lib/librfc822.tex
+39
-8
No files found.
Doc/lib/librfc822.tex
View file @
12991003
...
...
@@ -12,12 +12,24 @@ Note that there's a separate module to read \UNIX{}, MH, and MMDF
style mailbox files:
\module
{
mailbox
}
\refstmodindex
{
mailbox
}
.
\begin{classdesc}
{
Message
}{
file
\optional
{
, seekable
}}
A
\class
{
Message
}
instance is instantiated with an open file object as
parameter. The optional
\var
{
seekable
}
parameter indicates if the
file object is seekable; the default value is
\code
{
1
}
for true.
Instantiation reads headers from the file up to a blank line and
stores them in the instance; after instantiation, the file is
positioned directly after the blank line that terminates the headers.
A
\class
{
Message
}
instance is instantiated with an input object as
parameter. Message relies only on the input object having a
\code
{
readline
}
method; in particular, ordinary file objects qualify.
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.
The optional
\code
{
seekable
}
argument is provided as a workaround for
certain stdio libraries in which tell() discards buffered data before
discovering that the
\code
{
lseek()
}
system call doesn't work. For
maximum portability, you should set the seekable argument to zero to
prevent that initial
\code
{
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
by a single linefeed; a terminating CR-LF is replaced by a single
...
...
@@ -71,6 +83,18 @@ Seek to the start of the message body. This only works if the file
object is seekable.
\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.
\end{methoddesc}
\begin{methoddesc}
{
iscomment
}{
line
}
Return true if the given line should be ignored entirely, just skipped.
By default this is a stub that always returns false, but you can
override it in a subclass.
\end{methoddesc}
\begin{methoddesc}
{
getallmatchingheaders
}{
name
}
Return a list of lines consisting of all headers matching
\var
{
name
}
, if any. Each physical line, whether it is a continuation
...
...
@@ -92,9 +116,16 @@ any continuation line(s) were present. Return \code{None} if there is
no header matching
\var
{
name
}
.
\end{methoddesc}
\begin{methoddesc}
{
getheader
}{
name
}
\begin{methoddesc}
{
getheader
}{
name
\optional
{
, default
}
}
Like
\code
{
getrawheader(
\var
{
name
}
)
}
, but strip leading and trailing
whitespace. Internal whitespace is not stripped.
whitespace. Internal whitespace is not stripped. The optional
\var
{
default
}
argument can be used to specify a different default to
be returned when there is no header matching
\var
{
name
}
.
\end{methoddesc}
\begin{methoddesc}
{
get
}{
name
\optional
{
, default
}}
An alias for
\code
{
getheader()
}
, to make the interface more compatible
with regular dictionaries.
\end{methoddesc}
\begin{methoddesc}
{
getaddr
}{
name
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment