# HG changeset patch # User Augie Fackler # Date 1287270587 18000 # Node ID 21a50fe47a9286c726c77afc4ca53c429847727e # Parent 5eed9ceebd64ffdaa8080d82043d813e12f886f2 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. diff -r 5eed9ceebd64 -r 21a50fe47a92 hgext/interhg.py --- 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[:] = []