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.
This commit is contained in:
Brett Cannon 2008-08-16 21:47:07 +00:00
parent 1e296cc858
commit abe423ed2c
2 changed files with 9 additions and 1 deletions

View file

@ -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