summaryrefslogtreecommitdiff
path: root/Lib/BaseHTTPServer.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2008-08-16 21:47:07 +0000
committerBrett Cannon <bcannon@gmail.com>2008-08-16 21:47:07 +0000
commitabe423ed2cbf0ee118f6d060890258c2898fea1d (patch)
treeff1dc90be7bbff1a8823a7d9dcc8219d57f49464 /Lib/BaseHTTPServer.py
parent1e296cc8584ef0a6d5b70d8e1eff0a4971460503 (diff)
downloadcpython-git-abe423ed2cbf0ee118f6d060890258c2898fea1d.tar.gz
Silence the DeprecationWarning raised by importing mimetools in BaseHTTPServer.
This does have an unfortunate side-effect of silencing the warning for all subsequent code that imports mimetools as well since the warning is only executed upon the first import of mimetools.
Diffstat (limited to 'Lib/BaseHTTPServer.py')
-rw-r--r--Lib/BaseHTTPServer.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py
index 5f2d558b68..0a6381e422 100644
--- a/Lib/BaseHTTPServer.py
+++ b/Lib/BaseHTTPServer.py
@@ -73,7 +73,12 @@ __all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
import sys
import time
import socket # For gethostbyaddr()
-import mimetools
+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
import SocketServer
# Default error message template