]> granicus.if.org Git - python/commitdiff
Silence DeprecationWarning raised by mimetools and rfc822 in cgi.
authorBrett Cannon <bcannon@gmail.com>
Sat, 16 Aug 2008 22:00:27 +0000 (22:00 +0000)
committerBrett Cannon <bcannon@gmail.com>
Sat, 16 Aug 2008 22:00:27 +0000 (22:00 +0000)
Lib/cgi.py
Misc/NEWS

index 561f5adc566e5b05f962616962eb28ca7d5be26a..3a795c962c1d5ada70423c6dc02a1edce2a66dd1 100755 (executable)
@@ -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:
index 5d1feea77715095f94278f7af211d57834ff89ec..7736ca7c03ead89c7476d672af6df1e6c3345846 100644 (file)
--- 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.