Module rfc822 :: Class AddrlistClass
[hide private]
[frames] | no frames]

Class AddrlistClass

Known Subclasses:

Address parser class by Ben Escoto.

To understand what this class does, it helps to have a copy of RFC 2822 in front of you.

http://www.faqs.org/rfcs/rfc2822.html

Note: this class interface is deprecated and may be removed in the future. Use rfc822.AddressList instead.

Instance Methods [hide private]
 
__init__(self, field)
Initialize a new instance.
 
gotonext(self)
Parse up to the start of the next address.
 
getaddrlist(self)
Parse all addresses.
 
getaddress(self)
Parse the next address.
 
getrouteaddr(self)
Parse a route address (Return-path value).
 
getaddrspec(self)
Parse an RFC 2822 addr-spec.
 
getdomain(self)
Get the complete domain name from an address.
 
getdelimited(self, beginchar, endchars, allowcomments=1)
Parse a header fragment delimited by special characters.
 
getquote(self)
Get a quote-delimited fragment from self's field.
 
getcomment(self)
Get a parenthesis-delimited fragment from self's field.
 
getdomainliteral(self)
Parse an RFC 2822 domain-literal.
 
getatom(self, atomends=None)
Parse an RFC 2822 atom.
 
getphraselist(self)
Parse a sequence of RFC 2822 phrases.
Method Details [hide private]

__init__(self, field)
(Constructor)

 

Initialize a new instance.

`field' is an unparsed address header field, containing one or more addresses.

getaddrlist(self)

 

Parse all addresses.

Returns a list containing all of the addresses.

getrouteaddr(self)

 

Parse a route address (Return-path value).

This method just skips all the route stuff and returns the addrspec.

getdelimited(self, beginchar, endchars, allowcomments=1)

 

Parse a header fragment delimited by special characters.

`beginchar' is the start character for the fragment. If self is not looking at an instance of `beginchar' then getdelimited returns the empty string.

`endchars' is a sequence of allowable end-delimiting characters. Parsing stops when one of these is encountered.

If `allowcomments' is non-zero, embedded RFC 2822 comments are allowed within the parsed fragment.

getatom(self, atomends=None)

 

Parse an RFC 2822 atom.

Optional atomends specifies a different set of end token delimiters (the default is to use self.atomends). This is used e.g. in getphraselist() since phrase endings must not include the `.' (which is legal in phrases).

getphraselist(self)

 

Parse a sequence of RFC 2822 phrases.

A phrase is a sequence of words, which are in turn either RFC 2822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space.