Mercurial > public > mercurial-scm > hg-stable
diff mercurial/templatefilters.py @ 36926:6ff6e1d6b5b8
templater: move stringify() to templateutil module
As we have a util module, it doesn't make sense to import stringify() from
templatefilters.py.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 08 Mar 2018 23:10:46 +0900 |
parents | 82af07e1ae16 |
children | 32f9b7e3f056 |
line wrap: on
line diff
--- a/mercurial/templatefilters.py Wed Feb 28 15:20:41 2018 -0500 +++ b/mercurial/templatefilters.py Thu Mar 08 23:10:46 2018 +0900 @@ -18,6 +18,7 @@ pycompat, registrar, templatekw, + templateutil, url, util, ) @@ -376,18 +377,7 @@ """Any type. Turns the value into text by converting values into text and concatenating them. """ - thing = templatekw.unwraphybrid(thing) - if util.safehasattr(thing, '__iter__') and not isinstance(thing, bytes): - if isinstance(thing, str): - # This is only reachable on Python 3 (otherwise - # isinstance(thing, bytes) would have been true), and is - # here to prevent infinite recursion bugs on Python 3. - raise error.ProgrammingError( - 'stringify got unexpected unicode string: %r' % thing) - return "".join([stringify(t) for t in thing if t is not None]) - if thing is None: - return "" - return pycompat.bytestr(thing) + return templateutil.stringify(thing) @templatefilter('stripdir') def stripdir(text):