D2829: hgweb: port to new response API

2018-03-12 Thread indygreg (Gregory Szorc)
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
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2829: hgweb: port to new response API

2018-03-12 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  These were the last consumers of wsgirequest.respond() \o/

REPOSITORY
  rHG Mercurial

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
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel