Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(158917)

Side by Side Diff: Doc/library/email.errors.rst

Issue 18761: Fix internal doc references for the email package (Closed)
Patch Set: Created 6 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 :mod:`email.errors`: Exception and Defect classes 1 :mod:`email.errors`: Exception and Defect classes
2 ------------------------------------------------- 2 -------------------------------------------------
3 3
4 .. module:: email.errors 4 .. module:: email.errors
5 :synopsis: The exception classes used by the email package. 5 :synopsis: The exception classes used by the email package.
6 6
7 7
8 The following exception classes are defined in the :mod:`email.errors` module: 8 The following exception classes are defined in the :mod:`email.errors` module:
9 9
10 10
11 .. exception:: MessageError() 11 .. exception:: MessageError()
12 12
13 This is the base class for all exceptions that the :mod:`email` package can 13 This is the base class for all exceptions that the :mod:`email` package can
14 raise. It is derived from the standard :exc:`Exception` class and defines no 14 raise. It is derived from the standard :exc:`Exception` class and defines no
15 additional methods. 15 additional methods.
16 16
17 17
18 .. exception:: MessageParseError() 18 .. exception:: MessageParseError()
19 19
20 This is the base class for exceptions raised by the :class:`~email.parser.Par ser` 20 This is the base class for exceptions raised by the :class:`~email.parser.Par ser`
21 class. It is derived from :exc:`MessageError`. 21 class. It is derived from :exc:`MessageError`.
22 22
23 23
24 .. exception:: HeaderParseError() 24 .. exception:: HeaderParseError()
25 25
26 Raised under some error conditions when parsing the :rfc:`2822` headers of a 26 Raised under some error conditions when parsing the :rfc:`2822` headers of a
27 message, this class is derived from :exc:`MessageParseError`. It can be raise d 27 message, this class is derived from :exc:`MessageParseError`. It can be raise d
28 from the :meth:`Parser.parse` or :meth:`Parser.parsestr` methods. 28 from the :meth:`Parser.parse <email.parser.Parser.parse>` or :meth:`Parser.pa rsestr <email.parser.Parser.parsestr>` methods.
29 29
30 Situations where it can be raised include finding an envelope header after th e 30 Situations where it can be raised include finding an envelope header after th e
31 first :rfc:`2822` header of the message, finding a continuation line before t he 31 first :rfc:`2822` header of the message, finding a continuation line before t he
32 first :rfc:`2822` header is found, or finding a line in the headers which is 32 first :rfc:`2822` header is found, or finding a line in the headers which is
33 neither a header or a continuation line. 33 neither a header or a continuation line.
34 34
35 35
36 .. exception:: BoundaryError() 36 .. exception:: BoundaryError()
37 37
38 Raised under some error conditions when parsing the :rfc:`2822` headers of a 38 Raised under some error conditions when parsing the :rfc:`2822` headers of a
39 message, this class is derived from :exc:`MessageParseError`. It can be raise d 39 message, this class is derived from :exc:`MessageParseError`. It can be raise d
40 from the :meth:`Parser.parse` or :meth:`Parser.parsestr` methods. 40 from the :meth:`Parser.parse <email.parser.Parser.parse>` or :meth:`Parser.pa rsestr <email.parser.Parser.parsestr>` methods.
41 41
42 Situations where it can be raised include not being able to find the starting or 42 Situations where it can be raised include not being able to find the starting or
43 terminating boundary in a :mimetype:`multipart/\*` message when strict parsin g 43 terminating boundary in a :mimetype:`multipart/\*` message when strict parsin g
44 is used. 44 is used.
45 45
46 46
47 .. exception:: MultipartConversionError() 47 .. exception:: MultipartConversionError()
48 48
49 Raised when a payload is added to a :class:`Message` object using 49 Raised when a payload is added to a :class:`~email.message.Message` object us ing
50 :meth:`add_payload`, but the payload is already a scalar and the message's 50 :meth:`~email.message.Message.add_payload`, but the payload is already a scal ar and the message's
r.david.murray 2013/08/16 23:31:43 add_payload no longer exists.
storchaka 2013/08/18 21:39:21 Done.
51 :mailheader:`Content-Type` main type is not either :mimetype:`multipart` or 51 :mailheader:`Content-Type` main type is not either :mimetype:`multipart` or
52 missing. :exc:`MultipartConversionError` multiply inherits from 52 missing. :exc:`MultipartConversionError` multiply inherits from
53 :exc:`MessageError` and the built-in :exc:`TypeError`. 53 :exc:`MessageError` and the built-in :exc:`TypeError`.
54 54
55 Since :meth:`Message.add_payload` is deprecated, this exception is rarely rai sed 55 Since :meth:`Message.add_payload <email.message.Message.add_payload>` is depr ecated, this exception is rarely raised
56 in practice. However the exception may also be raised if the :meth:`attach` 56 in practice. However the exception may also be raised if the :meth:`~email.m essage.Message.attach`
57 method is called on an instance of a class derived from 57 method is called on an instance of a class derived from
58 :class:`~email.mime.nonmultipart.MIMENonMultipart` (e.g. 58 :class:`~email.mime.nonmultipart.MIMENonMultipart` (e.g.
59 :class:`~email.mime.image.MIMEImage`). 59 :class:`~email.mime.image.MIMEImage`).
60 60
61 Here's the list of the defects that the :class:`~email.mime.parser.FeedParser` 61 Here's the list of the defects that the :class:`~email.parser.FeedParser`
62 can find while parsing messages. Note that the defects are added to the message 62 can find while parsing messages. Note that the defects are added to the message
63 where the problem was found, so for example, if a message nested inside a 63 where the problem was found, so for example, if a message nested inside a
64 :mimetype:`multipart/alternative` had a malformed header, that nested message 64 :mimetype:`multipart/alternative` had a malformed header, that nested message
65 object would have a defect, but the containing messages would not. 65 object would have a defect, but the containing messages would not.
66 66
67 All defect classes are subclassed from :class:`email.errors.MessageDefect`, but 67 All defect classes are subclassed from :class:`email.errors.MessageDefect`, but
68 this class is *not* an exception! 68 this class is *not* an exception!
69 69
70 * :class:`NoBoundaryInMultipartDefect` -- A message claimed to be a multipart, 70 * :class:`NoBoundaryInMultipartDefect` -- A message claimed to be a multipart,
71 but had no :mimetype:`boundary` parameter. 71 but had no :mimetype:`boundary` parameter.
(...skipping 19 matching lines...) Expand all
91 .. versionadded:: 3.3 91 .. versionadded:: 3.3
92 92
93 * :class:`MalformedHeaderDefect` -- A header was found that was missing a colon, 93 * :class:`MalformedHeaderDefect` -- A header was found that was missing a colon,
94 or was otherwise malformed. 94 or was otherwise malformed.
95 95
96 .. deprecated:: 3.3 96 .. deprecated:: 3.3
97 This defect has not been used for several Python versions. 97 This defect has not been used for several Python versions.
98 98
99 * :class:`MultipartInvariantViolationDefect` -- A message claimed to be a 99 * :class:`MultipartInvariantViolationDefect` -- A message claimed to be a
100 :mimetype:`multipart`, but no subparts were found. Note that when a message h as 100 :mimetype:`multipart`, but no subparts were found. Note that when a message h as
101 this defect, its :meth:`is_multipart` method may return false even though its 101 this defect, its :meth:`~email.message.Message.is_multipart` method may return false even though its
102 content type claims to be :mimetype:`multipart`. 102 content type claims to be :mimetype:`multipart`.
103 103
104 * :class:`InvalidBase64PaddingDefect` -- When decoding a block of base64 104 * :class:`InvalidBase64PaddingDefect` -- When decoding a block of base64
105 enocded bytes, the padding was not correct. Enough padding is added to 105 enocded bytes, the padding was not correct. Enough padding is added to
106 perform the decode, but the resulting decoded bytes may be invalid. 106 perform the decode, but the resulting decoded bytes may be invalid.
107 107
108 * :class:`InvalidBase64CharactersDefect` -- When decoding a block of base64 108 * :class:`InvalidBase64CharactersDefect` -- When decoding a block of base64
109 enocded bytes, characters outside the base64 alphebet were encountered. 109 enocded bytes, characters outside the base64 alphebet were encountered.
110 The characters are ignored, but the resulting decoded bytes may be invalid. 110 The characters are ignored, but the resulting decoded bytes may be invalid.
OLDNEW
« no previous file with comments | « no previous file | Doc/library/email.headerregistry.rst » ('j') | Doc/library/email.headerregistry.rst » ('J')

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+