Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/common.py @ 5563:d61fea133f2d
hgweb: fix breaking tests on Python < 2.5
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Wed, 28 Nov 2007 09:39:17 -0800 |
parents | 22713dce19f6 |
children | 0145f9afb0e7 |
line wrap: on
line diff
--- a/mercurial/hgweb/common.py Wed Nov 28 08:39:05 2007 -0800 +++ b/mercurial/hgweb/common.py Wed Nov 28 09:39:17 2007 -0800 @@ -12,11 +12,18 @@ def __init__(self, code, message=None): Exception.__init__(self) self.code = code - if message is None: - from httplib import responses - self.message = responses.get(code, 'Error') + if message: + self.message = message else: - self.message = message + self.message = _statusmessage(code) + +def _statusmessage(code): + from BaseHTTPServer import BaseHTTPRequestHandler + responses = BaseHTTPRequestHandler.responses + return responses.get(code, ('Error', 'Unknown error'))[0] + +def statusmessage(code): + return '%d %s' % (code, _statusmessage(code)) def get_mtime(repo_path): store_path = os.path.join(repo_path, ".hg")