mercurial/templatefilters.py
changeset 23707 ae5447de4c11
parent 22668 13e3f07d74a3
child 23708 a9f826c3eaf9
equal deleted inserted replaced
23706:3314664606e6 23707:ae5447de4c11
   206     elif util.safehasattr(obj, '__iter__'):
   206     elif util.safehasattr(obj, '__iter__'):
   207         out = []
   207         out = []
   208         for i in obj:
   208         for i in obj:
   209             out.append(json(i))
   209             out.append(json(i))
   210         return '[' + ', '.join(out) + ']'
   210         return '[' + ', '.join(out) + ']'
       
   211     elif util.safehasattr(obj, '__call__'):
       
   212         return json(obj())
   211     else:
   213     else:
   212         raise TypeError('cannot encode type %s' % obj.__class__.__name__)
   214         raise TypeError('cannot encode type %s' % obj.__class__.__name__)
   213 
   215 
   214 def _uescape(c):
   216 def _uescape(c):
   215     if ord(c) < 0x80:
   217     if ord(c) < 0x80: