comparison mercurial/hgweb/common.py @ 9694:8269fe2d48f6

hgweb: send proper error messages to the client Fixes a bug in protocol which caused an exception during exception handling in some cases on Windows. Also makes sure the server error message is correctly propagated to the client, instead of being thrown away.
author Sune Foldager <cryo@cyanite.org>
date Mon, 02 Nov 2009 10:20:04 +0100
parents 3b76321aa0de
children 6f92997dbdca 25e572394f5c
comparison
equal deleted inserted replaced
9693:c40a1ee20aa5 9694:8269fe2d48f6
29 def _statusmessage(code): 29 def _statusmessage(code):
30 from BaseHTTPServer import BaseHTTPRequestHandler 30 from BaseHTTPServer import BaseHTTPRequestHandler
31 responses = BaseHTTPRequestHandler.responses 31 responses = BaseHTTPRequestHandler.responses
32 return responses.get(code, ('Error', 'Unknown error'))[0] 32 return responses.get(code, ('Error', 'Unknown error'))[0]
33 33
34 def statusmessage(code): 34 def statusmessage(code, message=None):
35 return '%d %s' % (code, _statusmessage(code)) 35 return '%d %s' % (code, message or _statusmessage(code))
36 36
37 def get_mtime(repo_path): 37 def get_mtime(repo_path):
38 store_path = os.path.join(repo_path, ".hg") 38 store_path = os.path.join(repo_path, ".hg")
39 if not os.path.isdir(os.path.join(store_path, "data")): 39 if not os.path.isdir(os.path.join(store_path, "data")):
40 store_path = os.path.join(store_path, "store") 40 store_path = os.path.join(store_path, "store")