##// END OF EJS Templates
hgweb: port to new response API...
Gregory Szorc -
r36923:c1de7efc default
parent child Browse files
Show More
@@ -15,7 +15,6 b' from ..i18n import _'
15 15
16 16 from .common import (
17 17 ErrorResponse,
18 HTTP_NOT_FOUND,
19 18 HTTP_SERVER_ERROR,
20 19 cspvalues,
21 20 get_contact,
@@ -23,6 +22,7 b' from .common import ('
23 22 ismember,
24 23 paritygen,
25 24 staticfile,
25 statusmessage,
26 26 )
27 27
28 28 from .. import (
@@ -31,6 +31,7 b' from .. import ('
31 31 error,
32 32 hg,
33 33 profiling,
34 pycompat,
34 35 scmutil,
35 36 templater,
36 37 ui as uimod,
@@ -442,12 +443,14 b' class hgwebdir(object):'
442 443 return self.makeindex(req, res, tmpl, subdir)
443 444
444 445 # prefixes not found
445 wsgireq.respond(HTTP_NOT_FOUND, ctype)
446 return tmpl("notfound", repo=virtual)
446 res.status = '404 Not Found'
447 res.setbodygen(tmpl('notfound', repo=virtual))
448 return res.sendresponse()
447 449
448 except ErrorResponse as err:
449 wsgireq.respond(err, ctype)
450 return tmpl('error', error=err.message or '')
450 except ErrorResponse as e:
451 res.status = statusmessage(e.code, pycompat.bytestr(e))
452 res.setbodygen(tmpl('error', error=e.message or ''))
453 return res.sendresponse()
451 454 finally:
452 455 tmpl = None
453 456
General Comments 0
You need to be logged in to leave comments. Login now