[Python-checkins] python/dist/src/Lib cgi.py,1.82,1.83

jlgijsbers at users.sourceforge.net jlgijsbers at users.sourceforge.net
Sat Jan 8 14:56:50 CET 2005


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16282
Modified Files:
	cgi.py 
Log Message:
Patch #1079734: remove dependencies on (deprecated) rfc822 and mimetools
modules, replacing with email. Thanks to Josh Hoyt for the patch!
Index: cgi.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/cgi.py,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- cgi.py	31 Dec 2004 21:59:02 -0000	1.82
+++ cgi.py	8 Jan 2005 13:56:36 -0000	1.83
@@ -38,8 +38,7 @@
 import sys
 import os
 import urllib
-import mimetools
-import rfc822
+import email.Parser
 import UserDict
 try:
 from cStringIO import StringIO
@@ -108,6 +107,8 @@
 # Parsing functions
 # =================
 
+_header_parser = email.Parser.HeaderParser()
+
 # Maximum input we will accept when REQUEST_METHOD is POST
 # 0 ==> unlimited input
 maxlen = 0
@@ -237,7 +238,7 @@
 
 Arguments:
 fp : input file
- pdict: dictionary containing other parameters of conten-type header
+ pdict: dictionary containing other parameters of content-type header
 
 Returns a dictionary just like parse_qs(): keys are the field names, each
 value is a list of values for that field. This is easy to use but not
@@ -270,7 +271,7 @@
 data = None
 if terminator:
 # At start of next part. Read headers first.
- headers = mimetools.Message(fp)
+ headers = _header_parser.parse(fp)
 clength = headers.getheader('content-length')
 if clength:
 try:
@@ -407,8 +408,9 @@
 
 disposition_options: dictionary of corresponding options
 
- headers: a dictionary(-like) object (sometimes rfc822.Message or a
- subclass thereof) containing *all* headers
+ headers: a dictionary(-like) object (sometimes
+ email.Message.Message or a subclass thereof) containing *all*
+ headers
 
 The class is subclassable, mostly for the purpose of overriding
 the make_file() method, which is called internally to come up with
@@ -650,7 +652,7 @@
 environ, keep_blank_values, strict_parsing)
 # Throw first part away
 while not part.done:
- headers = rfc822.Message(self.fp)
+ headers = _header_parser.parse(self.fp)
 part = klass(self.fp, headers, ib,
 environ, keep_blank_values, strict_parsing)
 self.list.append(part)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /