[PATCH 2 of 3 RFC STABLE] hgweb: give ErrorResponse descriptive string/Exception representation

Mads Kiilerich mads at kiilerich.com
Fri Feb 18 20:18:33 CST 2011


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1298081621 -3600
# Branch stable
# Node ID b1ef6f31f8d7982423ef602cb42c40f3d263aaeb
# Parent  ff833ea575ee79d91cfa9cfe7e04d8937cff9d30
hgweb: give ErrorResponse descriptive string/Exception representation

diff --git a/mercurial/hgweb/common.py b/mercurial/hgweb/common.py
--- a/mercurial/hgweb/common.py
+++ b/mercurial/hgweb/common.py
@@ -71,13 +71,12 @@
 
 class ErrorResponse(Exception):
     def __init__(self, code, message=None, headers=[]):
-        Exception.__init__(self)
+        if message is None:
+            message = _statusmessage(code)
+        Exception.__init__(self, code, message)
         self.code = code
+        self.message = message
         self.headers = headers
-        if message is not None:
-            self.message = message
-        else:
-            self.message = _statusmessage(code)
 
 def _statusmessage(code):
     from BaseHTTPServer import BaseHTTPRequestHandler


More information about the Mercurial-devel mailing list