diff mercurial/templateutil.py @ 38452:b6294c113794

templater: fix truth testing of integer 0 taken from a list/dict Broken at f9c426385853. bool(python_value) shouldn't be used here since an integer 0 has to be truthy for backward compatibility.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 17 Jun 2018 16:10:38 +0900
parents 88e7105b5cd9
children dae829b4de78
line wrap: on
line diff
--- a/mercurial/templateutil.py	Mon Jun 18 21:58:04 2018 +0900
+++ b/mercurial/templateutil.py	Sun Jun 17 16:10:38 2018 +0900
@@ -350,7 +350,8 @@
         return gen
 
     def tobool(self, context, mapping):
-        return bool(self.tovalue(context, mapping))
+        w = makewrapped(context, mapping, self._value)
+        return w.tobool(context, mapping)
 
     def tovalue(self, context, mapping):
         return _unthunk(context, mapping, self._value)