| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="prev" href="node584.html" /> |
| 13 | <link rel="parent" href="module-email.Parser.html" /> |
| 14 | <link rel="next" href="module-email.Generator.html" /> |
| 15 | <meta name='aesop' content='information' /> |
| 16 | <title>12.2.2.3 Additional notes</title> |
| 17 | </head> |
| 18 | <body> |
| 19 | <DIV CLASS="navigation"> |
| 20 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 21 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 22 | <tr> |
| 23 | <td class='online-navigation'><a rel="prev" title="12.2.2.2 Parser class API" |
| 24 | href="node584.html"><img src='../icons/previous.png' |
| 25 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 26 | <td class='online-navigation'><a rel="parent" title="12.2.2 Parsing email messages" |
| 27 | href="module-email.Parser.html"><img src='../icons/up.png' |
| 28 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 29 | <td class='online-navigation'><a rel="next" title="12.2.3 Generating MIME documents" |
| 30 | href="module-email.Generator.html"><img src='../icons/next.png' |
| 31 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 32 | <td align="center" width="100%">Python Library Reference</td> |
| 33 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 34 | href="contents.html"><img src='../icons/contents.png' |
| 35 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 36 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 37 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 38 | <td class='online-navigation'><a rel="index" title="Index" |
| 39 | href="genindex.html"><img src='../icons/index.png' |
| 40 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 41 | </tr></table> |
| 42 | <div class='online-navigation'> |
| 43 | <b class="navlabel">Previous:</b> |
| 44 | <a class="sectref" rel="prev" href="node584.html">12.2.2.2 Parser class API</A> |
| 45 | <b class="navlabel">Up:</b> |
| 46 | <a class="sectref" rel="parent" href="module-email.Parser.html">12.2.2 Parsing email messages</A> |
| 47 | <b class="navlabel">Next:</b> |
| 48 | <a class="sectref" rel="next" href="module-email.Generator.html">12.2.3 Generating MIME documents</A> |
| 49 | </div> |
| 50 | <hr /></div> |
| 51 | </DIV> |
| 52 | <!--End of Navigation Panel--> |
| 53 | |
| 54 | <H3><A NAME="SECTION0014223000000000000000"> |
| 55 | 12.2.2.3 Additional notes</A> |
| 56 | </H3> |
| 57 | |
| 58 | <P> |
| 59 | Here are some notes on the parsing semantics: |
| 60 | |
| 61 | <P> |
| 62 | |
| 63 | <UL> |
| 64 | <LI>Most non-<span class="mimetype">multipart</span> type messages are parsed as a single |
| 65 | message object with a string payload. These objects will return |
| 66 | <code>False</code> for <tt class="method">is_multipart()</tt>. Their |
| 67 | <tt class="method">get_payload()</tt> method will return a string object. |
| 68 | |
| 69 | <P> |
| 70 | </LI> |
| 71 | <LI>All <span class="mimetype">multipart</span> type messages will be parsed as a |
| 72 | container message object with a list of sub-message objects for |
| 73 | their payload. The outer container message will return |
| 74 | <code>True</code> for <tt class="method">is_multipart()</tt> and their |
| 75 | <tt class="method">get_payload()</tt> method will return the list of |
| 76 | <tt class="class">Message</tt> subparts. |
| 77 | |
| 78 | <P> |
| 79 | </LI> |
| 80 | <LI>Most messages with a content type of <span class="mimetype">message/*</span> |
| 81 | (e.g. <span class="mimetype">message/delivery-status</span> and |
| 82 | <span class="mimetype">message/rfc822</span>) will also be parsed as container |
| 83 | object containing a list payload of length 1. Their |
| 84 | <tt class="method">is_multipart()</tt> method will return <code>True</code>. The |
| 85 | single element in the list payload will be a sub-message object. |
| 86 | |
| 87 | <P> |
| 88 | </LI> |
| 89 | <LI>Some non-standards compliant messages may not be internally consistent |
| 90 | about their <span class="mimetype">multipart</span>-edness. Such messages may have a |
| 91 | <span class="mailheader">Content-Type:</span> header of type <span class="mimetype">multipart</span>, but their |
| 92 | <tt class="method">is_multipart()</tt> method may return <code>False</code>. If such |
| 93 | messages were parsed with the <tt class="class">FeedParser</tt>, they will have an |
| 94 | instance of the <tt class="class">MultipartInvariantViolationDefect</tt> class in their |
| 95 | <var>defects</var> attribute list. See <tt class="module"><a href="module-email.Errors.html">email.Errors</a></tt> for |
| 96 | details. |
| 97 | </LI> |
| 98 | </UL> |
| 99 | |
| 100 | <P> |
| 101 | |
| 102 | <DIV CLASS="navigation"> |
| 103 | <div class='online-navigation'> |
| 104 | <p></p><hr /> |
| 105 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 106 | <tr> |
| 107 | <td class='online-navigation'><a rel="prev" title="12.2.2.2 Parser class API" |
| 108 | href="node584.html"><img src='../icons/previous.png' |
| 109 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 110 | <td class='online-navigation'><a rel="parent" title="12.2.2 Parsing email messages" |
| 111 | href="module-email.Parser.html"><img src='../icons/up.png' |
| 112 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 113 | <td class='online-navigation'><a rel="next" title="12.2.3 Generating MIME documents" |
| 114 | href="module-email.Generator.html"><img src='../icons/next.png' |
| 115 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 116 | <td align="center" width="100%">Python Library Reference</td> |
| 117 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 118 | href="contents.html"><img src='../icons/contents.png' |
| 119 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 120 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 121 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 122 | <td class='online-navigation'><a rel="index" title="Index" |
| 123 | href="genindex.html"><img src='../icons/index.png' |
| 124 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 125 | </tr></table> |
| 126 | <div class='online-navigation'> |
| 127 | <b class="navlabel">Previous:</b> |
| 128 | <a class="sectref" rel="prev" href="node584.html">12.2.2.2 Parser class API</A> |
| 129 | <b class="navlabel">Up:</b> |
| 130 | <a class="sectref" rel="parent" href="module-email.Parser.html">12.2.2 Parsing email messages</A> |
| 131 | <b class="navlabel">Next:</b> |
| 132 | <a class="sectref" rel="next" href="module-email.Generator.html">12.2.3 Generating MIME documents</A> |
| 133 | </div> |
| 134 | </div> |
| 135 | <hr /> |
| 136 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 137 | </DIV> |
| 138 | <!--End of Navigation Panel--> |
| 139 | <ADDRESS> |
| 140 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 141 | </ADDRESS> |
| 142 | </BODY> |
| 143 | </HTML> |