summaryrefslogtreecommitdiff
path: root/Doc/library/email.parser.rst
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-04-25 01:59:09 +0000
committerBenjamin Peterson <benjamin@python.org>2008-04-25 01:59:09 +0000
commit1d3227e5f9f7acf2275f31ba44dffaf60262b824 (patch)
tree83462006efe4ed692d231a1a48dc7e6068fcf594 /Doc/library/email.parser.rst
parentb908467e23de983449e97fc6d253b277101d01ef (diff)
downloadcpython-1d3227e5f9f7acf2275f31ba44dffaf60262b824.tar.gz
Merged revisions 62490 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r62490 | benjamin.peterson | 2008-04-24 20:29:10 -0500 (Thu, 24 Apr 2008) | 2 lines reformat some documentation of classes so methods and attributes are under the class directive ........
Diffstat (limited to 'Doc/library/email.parser.rst')
-rw-r--r--Doc/library/email.parser.rst59
1 files changed, 30 insertions, 29 deletions
diff --git a/Doc/library/email.parser.rst b/Doc/library/email.parser.rst
index 6d623a7730..7a00912b56 100644
--- a/Doc/library/email.parser.rst
+++ b/Doc/library/email.parser.rst
@@ -65,20 +65,21 @@ Here is the API for the :class:`FeedParser`:
defaults to the :class:`email.message.Message` class.
-.. method:: FeedParser.feed(data)
+ .. method:: feed(data)
- Feed the :class:`FeedParser` some more data. *data* should be a string
- containing one or more lines. The lines can be partial and the
- :class:`FeedParser` will stitch such partial lines together properly. The lines
- in the string can have any of the common three line endings, carriage return,
- newline, or carriage return and newline (they can even be mixed).
+ Feed the :class:`FeedParser` some more data. *data* should be a string
+ containing one or more lines. The lines can be partial and the
+ :class:`FeedParser` will stitch such partial lines together properly. The
+ lines in the string can have any of the common three line endings,
+ carriage return, newline, or carriage return and newline (they can even be
+ mixed).
-.. method:: FeedParser.close()
+ .. method:: close()
- Closing a :class:`FeedParser` completes the parsing of all previously fed data,
- and returns the root message object. It is undefined what happens if you feed
- more data to a closed :class:`FeedParser`.
+ Closing a :class:`FeedParser` completes the parsing of all previously fed
+ data, and returns the root message object. It is undefined what happens
+ if you feed more data to a closed :class:`FeedParser`.
Parser class API
@@ -111,33 +112,33 @@ class.
effectively non-strict. You should simply stop passing a *strict* flag to
the :class:`Parser` constructor.
-The other public :class:`Parser` methods are:
+ The other public :class:`Parser` methods are:
-.. method:: Parser.parse(fp[, headersonly])
+ .. method:: parse(fp[, headersonly])
- Read all the data from the file-like object *fp*, parse the resulting text, and
- return the root message object. *fp* must support both the :meth:`readline` and
- the :meth:`read` methods on file-like objects.
+ Read all the data from the file-like object *fp*, parse the resulting
+ text, and return the root message object. *fp* must support both the
+ :meth:`readline` and the :meth:`read` methods on file-like objects.
- The text contained in *fp* must be formatted as a block of :rfc:`2822` style
- headers and header continuation lines, optionally preceded by a envelope
- header. The header block is terminated either by the end of the data or by a
- blank line. Following the header block is the body of the message (which may
- contain MIME-encoded subparts).
+ The text contained in *fp* must be formatted as a block of :rfc:`2822`
+ style headers and header continuation lines, optionally preceded by a
+ envelope header. The header block is terminated either by the end of the
+ data or by a blank line. Following the header block is the body of the
+ message (which may contain MIME-encoded subparts).
- Optional *headersonly* is as with the :meth:`parse` method.
+ Optional *headersonly* is as with the :meth:`parse` method.
+ .. method:: parsestr(text[, headersonly])
-.. method:: Parser.parsestr(text[, headersonly])
+ Similar to the :meth:`parse` method, except it takes a string object
+ instead of a file-like object. Calling this method on a string is exactly
+ equivalent to wrapping *text* in a :class:`StringIO` instance first and
+ calling :meth:`parse`.
- Similar to the :meth:`parse` method, except it takes a string object instead of
- a file-like object. Calling this method on a string is exactly equivalent to
- wrapping *text* in a :class:`StringIO` instance first and calling :meth:`parse`.
-
- Optional *headersonly* is a flag specifying whether to stop parsing after
- reading the headers or not. The default is ``False``, meaning it parses the
- entire contents of the file.
+ Optional *headersonly* is a flag specifying whether to stop parsing after
+ reading the headers or not. The default is ``False``, meaning it parses
+ the entire contents of the file.
Since creating a message object structure from a string or a file object is such