home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
p
/
python
/
pyhtmldoc
/
m
/
mimetools_
< prev
next >
Wrap
Text File
|
1996-11-14
|
2KB
|
45 lines
<TITLE>mimetools.Message Methods -- Python library reference</TITLE>
Prev: <A HREF="../m/mimetools" TYPE="Prev">mimetools</A>
Up: <A HREF="../m/mimetools" TYPE="Up">mimetools</A>
Top: <A HREF="../t/top" TYPE="Top">Top</A>
<H2>10.12.1. Additional Methods of Message objects</H2>
The <CODE>mimetools.Message</CODE> class defines the following methods in
addition to the <CODE>rfc822.Message</CODE> class:
<P>
<DL><DT><B>getplist</B> () -- Method on mimetool.Message<DD>
Return the parameter list of the <CODE>Content-type</CODE> header. This is
a list if strings. For parameters of the form
`<SAMP><VAR>key</VAR>=<VAR>value</VAR></SAMP>', <VAR>key</VAR> is converted to lower case but
<VAR>value</VAR> is not. For example, if the message contains the header
`<SAMP>Content-type: text/html; spam=1; Spam=2; Spam</SAMP>' then
<CODE>getplist()</CODE> will return the Python list <CODE>['spam=1',
'spam=2', 'Spam']</CODE>.
</DL>
<DL><DT><B>getparam</B> (<VAR>name</VAR>) -- Method on mimetool.Message<DD>
Return the <VAR>value</VAR> of the first parameter (as returned by
<CODE>getplist()</CODE> of the form `<SAMP><VAR>name</VAR>=<VAR>value</VAR></SAMP>' for the
given <VAR>name</VAR>. If <VAR>value</VAR> is surrounded by quotes of the form
<VAR><...></VAR> or <VAR>"..."</VAR>, these are removed.
</DL>
<DL><DT><B>getencoding</B> () -- Method on mimetool.Message<DD>
Return the encoding specified in the `<SAMP>Content-transfer-encoding</SAMP>'
message header. If no such header exists, return <CODE>"7bit"</CODE>. The
encoding is converted to lower case.
</DL>
<DL><DT><B>gettype</B> () -- Method on mimetool.Message<DD>
Return the message type (of the form `<SAMP><VAR>type</VAR>/varsubtype</SAMP>')
as specified in the `<SAMP>Content-type</SAMP>' header. If no such header
exists, return <CODE>"text/plain"</CODE>. The type is converted to lower
case.
</DL>
<DL><DT><B>getmaintype</B> () -- Method on mimetool.Message<DD>
Return the main type as specified in the `<SAMP>Content-type</SAMP>' header.
If no such header exists, return <CODE>"text"</CODE>. The main type is
converted to lower case.
</DL>
<DL><DT><B>getsubtype</B> () -- Method on mimetool.Message<DD>
Return the subtype as specified in the `<SAMP>Content-type</SAMP>' header. If
no such header exists, return <CODE>"plain"</CODE>. The subtype is
converted to lower case.
</DL>