D2829: hgweb: port to new response API

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Mon Mar 12 17:43:22 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc1de7efca574: hgweb: port to new response API (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2829?vs=6895&id=6960

REVISION DETAIL
  https://phab.mercurial-scm.org/D2829

AFFECTED FILES
  mercurial/hgweb/hgwebdir_mod.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -15,22 +15,23 @@
 
 from .common import (
     ErrorResponse,
-    HTTP_NOT_FOUND,
     HTTP_SERVER_ERROR,
     cspvalues,
     get_contact,
     get_mtime,
     ismember,
     paritygen,
     staticfile,
+    statusmessage,
 )
 
 from .. import (
     configitems,
     encoding,
     error,
     hg,
     profiling,
+    pycompat,
     scmutil,
     templater,
     ui as uimod,
@@ -442,12 +443,14 @@
                 return self.makeindex(req, res, tmpl, subdir)
 
             # prefixes not found
-            wsgireq.respond(HTTP_NOT_FOUND, ctype)
-            return tmpl("notfound", repo=virtual)
+            res.status = '404 Not Found'
+            res.setbodygen(tmpl('notfound', repo=virtual))
+            return res.sendresponse()
 
-        except ErrorResponse as err:
-            wsgireq.respond(err, ctype)
-            return tmpl('error', error=err.message or '')
+        except ErrorResponse as e:
+            res.status = statusmessage(e.code, pycompat.bytestr(e))
+            res.setbodygen(tmpl('error', error=e.message or ''))
+            return res.sendresponse()
         finally:
             tmpl = None
 



To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel


More information about the Mercurial-devel mailing list