templater: fix string representation of wrapped None
authorYuya Nishihara <yuya@tcha.org>
Tue, 05 Jun 2018 21:40:33 +0900
changeset 38272 354fad8697fd
parent 38271 4b0f39e7406e
child 38273 9df777d7f061
templater: fix string representation of wrapped None flatten() and stringify() skip None, which means wrappedvalue(None).show() must return '' instead of 'None'. This isn't a problem right now, but we'll encounter it once we start using wrapped types extensively.
mercurial/templateutil.py
--- a/mercurial/templateutil.py	Fri Jun 08 20:57:54 2018 +0900
+++ b/mercurial/templateutil.py	Tue Jun 05 21:40:33 2018 +0900
@@ -155,6 +155,8 @@
         raise error.ParseError(_('%r is not iterable') % self._value)
 
     def show(self, context, mapping):
+        if self._value is None:
+            return b''
         return pycompat.bytestr(self._value)
 
     def tovalue(self, context, mapping):