home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pyhtmldoc / m / mimetools_ < prev    next >
Text File  |  1996-11-14  |  2KB  |  45 lines

  1. <TITLE>mimetools.Message Methods -- Python library reference</TITLE>
  2. Prev: <A HREF="../m/mimetools" TYPE="Prev">mimetools</A>  
  3. Up: <A HREF="../m/mimetools" TYPE="Up">mimetools</A>  
  4. Top: <A HREF="../t/top" TYPE="Top">Top</A>  
  5. <H2>10.12.1. Additional Methods of Message objects</H2>
  6. The <CODE>mimetools.Message</CODE> class defines the following methods in
  7. addition to the <CODE>rfc822.Message</CODE> class:
  8. <P>
  9. <DL><DT><B>getplist</B> () -- Method on mimetool.Message<DD>
  10. Return the parameter list of the <CODE>Content-type</CODE> header.  This is
  11. a list if strings.  For parameters of the form
  12. `<SAMP><VAR>key</VAR>=<VAR>value</VAR></SAMP>', <VAR>key</VAR> is converted to lower case but
  13. <VAR>value</VAR> is not.  For example, if the message contains the header
  14. `<SAMP>Content-type: text/html; spam=1; Spam=2; Spam</SAMP>' then
  15. <CODE>getplist()</CODE> will return the Python list <CODE>['spam=1',
  16. 'spam=2', 'Spam']</CODE>.
  17. </DL>
  18. <DL><DT><B>getparam</B> (<VAR>name</VAR>) -- Method on mimetool.Message<DD>
  19. Return the <VAR>value</VAR> of the first parameter (as returned by
  20. <CODE>getplist()</CODE> of the form `<SAMP><VAR>name</VAR>=<VAR>value</VAR></SAMP>' for the
  21. given <VAR>name</VAR>.  If <VAR>value</VAR> is surrounded by quotes of the form
  22. <VAR><...></VAR> or <VAR>"..."</VAR>, these are removed.
  23. </DL>
  24. <DL><DT><B>getencoding</B> () -- Method on mimetool.Message<DD>
  25. Return the encoding specified in the `<SAMP>Content-transfer-encoding</SAMP>'
  26. message header.  If no such header exists, return <CODE>"7bit"</CODE>.  The
  27. encoding is converted to lower case.
  28. </DL>
  29. <DL><DT><B>gettype</B> () -- Method on mimetool.Message<DD>
  30. Return the message type (of the form `<SAMP><VAR>type</VAR>/varsubtype</SAMP>')
  31. as specified in the `<SAMP>Content-type</SAMP>' header.  If no such header
  32. exists, return <CODE>"text/plain"</CODE>.  The type is converted to lower
  33. case.
  34. </DL>
  35. <DL><DT><B>getmaintype</B> () -- Method on mimetool.Message<DD>
  36. Return the main type as specified in the `<SAMP>Content-type</SAMP>' header.
  37. If no such header exists, return <CODE>"text"</CODE>.  The main type is
  38. converted to lower case.
  39. </DL>
  40. <DL><DT><B>getsubtype</B> () -- Method on mimetool.Message<DD>
  41. Return the subtype as specified in the `<SAMP>Content-type</SAMP>' header.  If
  42. no such header exists, return <CODE>"plain"</CODE>.  The subtype is
  43. converted to lower case.
  44. </DL>
  45.