diff mercurial/hgweb/request.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 d74fc8dec2b4
line wrap: on
line diff
--- a/mercurial/hgweb/request.py	Wed Nov 28 08:39:05 2007 -0800
+++ b/mercurial/hgweb/request.py	Wed Nov 28 09:39:17 2007 -0800
@@ -8,7 +8,7 @@
 
 import socket, cgi, errno
 from mercurial.i18n import gettext as _
-from common import ErrorResponse
+from common import ErrorResponse, statusmessage
 
 class wsgiapplication(object):
     def __init__(self, destmaker):
@@ -53,15 +53,10 @@
                 if self.server_write is None:
                     if not self.headers:
                         raise RuntimeError("request.write called before headers sent (%s)." % thing)
-                    code = None
                     if isinstance(status, ErrorResponse):
-                        code = status.code
+                        status = statusmessage(status.code)
                     elif isinstance(status, int):
-                        code = status
-                    if code:
-                        from httplib import responses
-                        status = '%d %s' % (
-                            code, responses.get(code, 'Error'))
+                        status = statusmessage(status)
                     self.server_write = self.start_response(status,
                                                             self.headers)
                     self.start_response = None