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