From: Brett Cannon Date: Sat, 16 Aug 2008 22:00:27 +0000 (+0000) Subject: Silence DeprecationWarning raised by mimetools and rfc822 in cgi. X-Git-Tag: v2.6b3~67 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=721b1457a0e36e49fe7f94a8f826661aa871fb08;p=thirdparty%2FPython%2Fcpython.git Silence DeprecationWarning raised by mimetools and rfc822 in cgi. --- diff --git a/Lib/cgi.py b/Lib/cgi.py index 561f5adc566e..3a795c962c1d 100755 --- a/Lib/cgi.py +++ b/Lib/cgi.py @@ -38,9 +38,16 @@ from operator import attrgetter import sys import os import urllib -import mimetools -import rfc822 import UserDict +from test.test_support import catch_warning +from warnings import filterwarnings +with catch_warning(record=False): + filterwarnings("ignore", ".*mimetools has been removed", + DeprecationWarning) + import mimetools + filterwarnings("ignore", ".*rfc822 has been removed", DeprecationWarning) + import rfc822 + try: from cStringIO import StringIO except ImportError: diff --git a/Misc/NEWS b/Misc/NEWS index 5d1feea77715..7736ca7c03ea 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -49,7 +49,7 @@ Library ------- - Silence the DeprecationWarning raised when importing mimetools in - BaseHTTPServer, httplib. + BaseHTTPServer, cgi (and rfc822), httplib. - Issue #2776: fixed small issue when handling an URL with double slash after a 302 response in the case of not going through a proxy.