[PATCH 1 of 4] templatefilters: drop callable support from json()

Yuya Nishihara yuya at tcha.org
Sat Apr 1 23:28:21 EDT 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1491101209 -32400
#      Sun Apr 02 11:46:49 2017 +0900
# Node ID 80483134bdbaeb72809a3e9683a263c7e166b3c8
# Parent  35eb8f112c88669ba3297de16a9acc289aacfdcd
templatefilters: drop callable support from json()

This backs out ae5447de4c11. A callable should be evaluated beforehand
by templater.runsymbol().

diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py
--- a/mercurial/templatefilters.py
+++ b/mercurial/templatefilters.py
@@ -236,8 +236,6 @@ def json(obj):
         for i in obj:
             out.append(json(i))
         return '[' + ', '.join(out) + ']'
-    elif util.safehasattr(obj, '__call__'):
-        return json(obj())
     else:
         raise TypeError('cannot encode type %s' % obj.__class__.__name__)
 


More information about the Mercurial-devel mailing list