Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgweb_mod.py @ 18855:50c922c1b514 stable 2.5.3
hgweb: show correct error message for i18n environment
If exception is error.LookupError and running in i18n environment,
below condition is always true.
Because msg is translated and dosen't contain 'manifest'.
if util.safehasattr(err, 'name') and 'manifest' not in msg:
This patch creates a new exception class and uses it instead of
string match.
author | Takumi IINO <trot.thunder@gmail.com> |
---|---|
date | Fri, 15 Feb 2013 18:07:14 +0900 |
parents | 36549fa712da |
children | f02045645d12 |
comparison
equal
deleted
inserted
replaced
18854:afab180307be | 18855:50c922c1b514 |
---|---|
243 return content | 243 return content |
244 | 244 |
245 except (error.LookupError, error.RepoLookupError), err: | 245 except (error.LookupError, error.RepoLookupError), err: |
246 req.respond(HTTP_NOT_FOUND, ctype) | 246 req.respond(HTTP_NOT_FOUND, ctype) |
247 msg = str(err) | 247 msg = str(err) |
248 if util.safehasattr(err, 'name') and 'manifest' not in msg: | 248 if (util.safehasattr(err, 'name') and |
249 not isinstance(err, error.ManifestLookupError)): | |
249 msg = 'revision not found: %s' % err.name | 250 msg = 'revision not found: %s' % err.name |
250 return tmpl('error', error=msg) | 251 return tmpl('error', error=msg) |
251 except (error.RepoError, error.RevlogError), inst: | 252 except (error.RepoError, error.RevlogError), inst: |
252 req.respond(HTTP_SERVER_ERROR, ctype) | 253 req.respond(HTTP_SERVER_ERROR, ctype) |
253 return tmpl('error', error=str(inst)) | 254 return tmpl('error', error=str(inst)) |