# HG changeset patch # User Yuya Nishihara # Date 2017-04-02 02:51:25 # Node ID 8d9eafe011110430cd11cf836fae6039eda389c4 # Parent fd687ec5a643fc0842584e37b3d31d60d6d55d3f templatefilters: unroll handling of None/False/True It doesn't make sense to use a dict here. diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -219,8 +219,12 @@ def indent(text, prefix): @templatefilter('json') def json(obj): - if obj is None or obj is False or obj is True: - return {None: 'null', False: 'false', True: 'true'}[obj] + if obj is None: + return 'null' + elif obj is False: + return 'false' + elif obj is True: + return 'true' elif isinstance(obj, (int, long, float)): return str(obj) elif isinstance(obj, str):