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
87294835
Commit
87294835
authored
Jun 16, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some extra notes, and describe a new class (AddressList), all by ESR.
parent
4d4ab924
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
2 deletions
+44
-2
Doc/lib/librfc822.tex
Doc/lib/librfc822.tex
+44
-2
No files found.
Doc/lib/librfc822.tex
View file @
87294835
...
...
@@ -6,7 +6,8 @@
This module defines a class,
\class
{
Message
}
, which represents a
collection of ``email headers'' as defined by the Internet standard
\rfc
{
822
}
. It is used in various contexts, usually to read such
headers from a file.
headers from a file. This module also defines a helper class
\class
{
AddressList
}
for parsing RFC822 addresses.
Note that there's a separate module to read
\UNIX
{}
, MH, and MMDF
style mailbox files:
\module
{
mailbox
}
\refstmodindex
{
mailbox
}
.
...
...
@@ -42,6 +43,12 @@ e.g. \code{\var{m}['From']}, \code{\var{m}['from']} and
\code
{
\var
{
m
}
['FROM']
}
all yield the same result.
\end{classdesc}
\begin{classdesc}
{
AddressList
}{
field
}
You may instantiate the AddresssList helper class using a single
string parameter, a comma-separated list of RFC822 addresses to be
parsed. (The parameter None yields an empty list.)
\end{classdesc}
\begin{funcdesc}
{
parsedate
}{
date
}
Attempts to parse a date according to the rules in
\rfc
{
822
}
.
however, some mailers don't follow that format as specified, so
...
...
@@ -198,10 +205,45 @@ Finally, \class{Message} instances have two public instance variables:
\begin{memberdesc}
{
headers
}
A list containing the entire set of header lines, in the order in
which they were read. Each line contains a trailing newline. The
which they were read (except that setitem calls may disturb this
order). Each line contains a trailing newline. The
blank line terminating the headers is not contained in the list.
\end{memberdesc}
\begin{memberdesc}
{
fp
}
The file object passed at instantiation time.
\end{memberdesc}
\subsection
{
AddressList Objects
}
\label
{
addresslist-objects
}
An
\class
{
AddressList
}
instance has the following methods:
\begin{methoddesc}
{__
len
__}{
name
}
Return the number of addresses in the address list.
\end{methoddesc}
\begin{methoddesc}
{__
str
__}{
name
}
Return a canonicalized string representation of the address list.
Addresses are rendered in "name" <host@domain> form, comma-separated.
\end{methoddesc}
\begin{methoddesc}
{__
add
__}{
name
}
Return an AddressList instance that contains all addresses in both
AddressList operands, with duplicates removed (set union).
\end{methoddesc}
\begin{methoddesc}
{__
sub
__}{
name
}
Return an AddressList instance that contains every address in the
left-hand AddressList operand that is not present in the right-hand
address operand (set difference).
\end{methoddesc}
Finally,
\class
{
AddressList
}
instances have one public instance variable:
\begin{memberdesc}
{
addresslist
}
A list of tuple string pairs, one per address. In each member, the
first is the canonicalized name part of the address, the second is the
route-address (@-separated host-domain pair).
\end{memberdesc}
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