Mercurial > hg
diff mercurial/hgweb/server.py @ 29433:33770d2b6cf9
py3: conditionalize SocketServer import
The SocketServer is renamed to socketserver in python 3
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 27 Jun 2016 16:48:54 +0530 |
parents | 032c4c2f802a |
children | cd3e58862cab |
line wrap: on
line diff
--- a/mercurial/hgweb/server.py Mon Jun 27 16:37:37 2016 +0530 +++ b/mercurial/hgweb/server.py Mon Jun 27 16:48:54 2016 +0530 @@ -9,7 +9,6 @@ from __future__ import absolute_import import BaseHTTPServer -import SocketServer import errno import os import socket @@ -23,6 +22,7 @@ util, ) +socketserver = util.socketserver urlerr = util.urlerr urlreq = util.urlreq @@ -147,9 +147,9 @@ env['wsgi.input'] = self.rfile env['wsgi.errors'] = _error_logger(self) env['wsgi.multithread'] = isinstance(self.server, - SocketServer.ThreadingMixIn) + socketserver.ThreadingMixIn) env['wsgi.multiprocess'] = isinstance(self.server, - SocketServer.ForkingMixIn) + socketserver.ForkingMixIn) env['wsgi.run_once'] = 0 self.saved_status = None @@ -240,10 +240,10 @@ try: import threading threading.activeCount() # silence pyflakes and bypass demandimport - _mixin = SocketServer.ThreadingMixIn + _mixin = socketserver.ThreadingMixIn except ImportError: if util.safehasattr(os, "fork"): - _mixin = SocketServer.ForkingMixIn + _mixin = socketserver.ForkingMixIn else: class _mixin(object): pass