comparison mercurial/hgweb/common.py @ 27044:1dde4914fb6c

hgweb: import BaseHTTPServer as module at top level This will avoid future warning spotted by the import checker.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 01 Nov 2015 15:07:08 +0900
parents 461e7b700fdf
children 37fcfe52c68c
comparison
equal deleted inserted replaced
27043:ccdc95c6841e 27044:1dde4914fb6c
4 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> 4 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
5 # 5 #
6 # This software may be used and distributed according to the terms of the 6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version. 7 # GNU General Public License version 2 or any later version.
8 8
9 import BaseHTTPServer
9 import errno, mimetypes, os 10 import errno, mimetypes, os
10 11
11 HTTP_OK = 200 12 HTTP_OK = 200
12 HTTP_NOT_MODIFIED = 304 13 HTTP_NOT_MODIFIED = 304
13 HTTP_BAD_REQUEST = 400 14 HTTP_BAD_REQUEST = 400
100 if attr in ('close', 'readline', 'readlines', '__iter__'): 101 if attr in ('close', 'readline', 'readlines', '__iter__'):
101 return getattr(self.f, attr) 102 return getattr(self.f, attr)
102 raise AttributeError 103 raise AttributeError
103 104
104 def _statusmessage(code): 105 def _statusmessage(code):
105 from BaseHTTPServer import BaseHTTPRequestHandler 106 responses = BaseHTTPServer.BaseHTTPRequestHandler.responses
106 responses = BaseHTTPRequestHandler.responses
107 return responses.get(code, ('Error', 'Unknown error'))[0] 107 return responses.get(code, ('Error', 'Unknown error'))[0]
108 108
109 def statusmessage(code, message=None): 109 def statusmessage(code, message=None):
110 return '%d %s' % (code, message or _statusmessage(code)) 110 return '%d %s' % (code, message or _statusmessage(code))
111 111