home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pyhtmldoc / f / functions < prev   
Text File  |  1996-11-14  |  3KB  |  61 lines

  1. <TITLE>Functions -- Python library reference</TITLE>
  2. Next: <A HREF="../c/caring_about_security" TYPE="Next">Caring about security</A>  
  3. Prev: <A HREF="../o/old_classes" TYPE="Prev">Old classes</A>  
  4. Up: <A HREF="../c/cgi" TYPE="Up">cgi</A>  
  5. Top: <A HREF="../t/top" TYPE="Top">Top</A>  
  6. <H2>10.1.4. Functions</H2>
  7. These are useful if you want more control, or if you want to employ
  8. some of the algorithms implemented in this module in other
  9. circumstances.
  10. <P>
  11. <DL><DT><B>parse</B> (<VAR>fp</VAR>) -- function of module cgi<DD>
  12. : Parse a query in the environment or from a file (default <CODE>sys.stdin</CODE>).
  13. </DL>
  14. <DL><DT><B>parse_qs</B> (<VAR>qs</VAR>) -- function of module cgi<DD>
  15. : parse a query string given as a string argument (data of type 
  16. <CODE>application/x-www-form-urlencoded</CODE>).
  17. </DL>
  18. <DL><DT><B>parse_multipart</B> (<VAR>fp</VAR>, <VAR>pdict</VAR>) -- function of module cgi<DD>
  19. : parse input of type <CODE>multipart/form-data</CODE> (for 
  20. file uploads).  Arguments are <CODE>fp</CODE> for the input file and 
  21. <CODE>pdict</CODE> for the dictionary containing other parameters of <CODE>content-type</CODE> header
  22. <P>
  23. Returns a dictionary just like <CODE>parse_qs()</CODE>: keys are the field names, each 
  24. value is a list of values for that field.  This is easy to use but not 
  25. much good if you are expecting megabytes to be uploaded -- in that case, 
  26. use the <CODE>FieldStorage</CODE> class instead which is much more flexible.  Note 
  27. that <CODE>content-type</CODE> is the raw, unparsed contents of the <CODE>content-type</CODE> 
  28. header.
  29. <P>
  30. Note that this does not parse nested multipart parts -- use <CODE>FieldStorage</CODE> for 
  31. that.
  32. </DL>
  33. <DL><DT><B>parse_header</B> (<VAR>string</VAR>) -- function of module cgi<DD>
  34. : parse a header like <CODE>Content-type</CODE> into a main
  35. content-type and a dictionary of parameters.
  36. </DL>
  37. <DL><DT><B>test</B> () -- function of module cgi<DD>
  38. : robust test CGI script, usable as main program.
  39. Writes minimal HTTP headers and formats all information provided to
  40. the script in HTML form.
  41. </DL>
  42. <DL><DT><B>print_environ</B> () -- function of module cgi<DD>
  43. : format the shell environment in HTML.
  44. </DL>
  45. <DL><DT><B>print_form</B> (<VAR>form</VAR>) -- function of module cgi<DD>
  46. : format a form in HTML.
  47. </DL>
  48. <DL><DT><B>print_directory</B> () -- function of module cgi<DD>
  49. : format the current directory in HTML.
  50. </DL>
  51. <DL><DT><B>print_environ_usage</B> () -- function of module cgi<DD>
  52. : print a list of useful (used by CGI) environment variables in
  53. HTML.
  54. </DL>
  55. <DL><DT><B>escape</B> () -- function of module cgi<DD>
  56. : convert the characters ``<CODE>&</CODE>'', ``<CODE><</CODE>'' and ``<CODE>></CODE>'' to HTML-safe
  57. sequences.  Use this if you need to display text that might contain
  58. such characters in HTML.  To translate URLs for inclusion in the HREF
  59. attribute of an <CODE><A></CODE> tag, use <CODE>urllib.quote()</CODE>.
  60. </DL>
  61.