Mercurial > hg
comparison mercurial/templater.py @ 34808:e87e62b7fc0b
templater: don't blow up when trying to build an abort message
__name__ is unicode, but we need bytes. For now, we'll make the
(mostly-safe) assumption that template filter names will be ascii.
Differential Revision: https://phab.mercurial-scm.org/D1137
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 16 Oct 2017 22:50:39 -0400 |
parents | b13c95919ff5 |
children | d3ea6a1c798f |
comparison
equal
deleted
inserted
replaced
34807:3caec3c032c8 | 34808:e87e62b7fc0b |
---|---|
425 return filt(thing) | 425 return filt(thing) |
426 except (ValueError, AttributeError, TypeError): | 426 except (ValueError, AttributeError, TypeError): |
427 sym = findsymbolicname(arg) | 427 sym = findsymbolicname(arg) |
428 if sym: | 428 if sym: |
429 msg = (_("template filter '%s' is not compatible with keyword '%s'") | 429 msg = (_("template filter '%s' is not compatible with keyword '%s'") |
430 % (filt.__name__, sym)) | 430 % (filt.__name__.encode('ascii'), sym)) |
431 else: | 431 else: |
432 msg = _("incompatible use of template filter '%s'") % filt.__name__ | 432 msg = _("incompatible use of template filter '%s'") % filt.__name__ |
433 raise error.Abort(msg) | 433 raise error.Abort(msg) |
434 | 434 |
435 def buildmap(exp, context): | 435 def buildmap(exp, context): |