diff mercurial/templatefilters.py @ 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 6abce80e6cbf
children 3a33412792f1
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):