changeset 25000:c54248bbe023

templatefilters: don't stringify None into "None" A few template keywords can in fact return None, such as {bisect}. In some contexts, these get stringified into None instead of "". This is leaking Python details into the UI.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Sun, 10 May 2015 13:33:51 -0400
parents 30f449378f64
children 9668c1a433b3
files mercurial/templatefilters.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templatefilters.py	Sun May 10 19:02:14 2015 +0800
+++ b/mercurial/templatefilters.py	Sun May 10 13:33:51 2015 -0400
@@ -326,6 +326,8 @@
     """
     if util.safehasattr(thing, '__iter__') and not isinstance(thing, str):
         return "".join([stringify(t) for t in thing if t is not None])
+    if thing is None:
+        return ""
     return str(thing)
 
 def strip(text):