mercurial/templatefilters.py
changeset 36920 6ff6e1d6b5b8
parent 36831 82af07e1ae16
child 36921 32f9b7e3f056
--- 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):