templatefilters: don't stringify None into "None"
authorJordi Gutiérrez Hermoso <jordigh@octave.org>
Sun, 10 May 2015 13:33:51 -0400
changeset 25000 c54248bbe023
parent 24999 30f449378f64
child 25001 9668c1a433b3
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.
mercurial/templatefilters.py
--- 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):