Mercurial > hg
changeset 12766:21a50fe47a92
interhg: use uisetup() instead of module-load side effects
This fixes an infinite recursion bug caused by visiting a bad subpage
of the help handler repeatedly, which caused the wrapper for the
templater's escape filter to get installed twice and resulted in
infinite recursion.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Sat, 16 Oct 2010 18:09:47 -0500 |
parents | 5eed9ceebd64 |
children | c3316b6a3219 |
files | hgext/interhg.py |
diffstat | 1 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/interhg.py Mon Oct 18 23:20:14 2010 -0500 +++ b/hgext/interhg.py Sat Oct 16 18:09:47 2010 -0500 @@ -28,17 +28,18 @@ from mercurial import templatefilters, extensions from mercurial.i18n import _ -orig_escape = templatefilters.filters["escape"] - interhg_table = [] -def interhg_escape(x): - escstr = orig_escape(x) - for regexp, format in interhg_table: - escstr = regexp.sub(format, escstr) - return escstr +def uisetup(ui): + orig_escape = templatefilters.filters["escape"] -templatefilters.filters["escape"] = interhg_escape + def interhg_escape(x): + escstr = orig_escape(x) + for regexp, format in interhg_table: + escstr = regexp.sub(format, escstr) + return escstr + + templatefilters.filters["escape"] = interhg_escape def interhg_refresh(orig, self, *args, **kwargs): interhg_table[:] = []