diff mercurial/hgweb/common.py @ 29566:075146e85bb6

py3: conditionalize BaseHTTPServer, SimpleHTTPServer and CGIHTTPServer import The BaseHTTPServer, SimpleHTTPServer and CGIHTTPServer has been merged into http.server in python 3. All of them has been merged as util.httpserver to use in both python 2 and 3. This patch adds a regex to check-code to warn against the use of BaseHTTPServer. Moreover this patch also includes updates to lower part of test-check-py3-compat.t which used to remain unchanged.
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 13 Jul 2016 23:38:29 +0530
parents 7f0498bd284e
children bb77654dc7ae
line wrap: on
line diff
--- a/mercurial/hgweb/common.py	Fri Jul 15 23:00:31 2016 +0530
+++ b/mercurial/hgweb/common.py	Wed Jul 13 23:38:29 2016 +0530
@@ -8,11 +8,14 @@
 
 from __future__ import absolute_import
 
-import BaseHTTPServer
 import errno
 import mimetypes
 import os
 
+from .. import util
+
+httpserver = util.httpserver
+
 HTTP_OK = 200
 HTTP_NOT_MODIFIED = 304
 HTTP_BAD_REQUEST = 400
@@ -107,7 +110,7 @@
         raise AttributeError
 
 def _statusmessage(code):
-    responses = BaseHTTPServer.BaseHTTPRequestHandler.responses
+    responses = httpserver.basehttprequesthandler.responses
     return responses.get(code, ('Error', 'Unknown error'))[0]
 
 def statusmessage(code, message=None):