mercurial/templatefilters.py
changeset 31779 fd687ec5a643
parent 31728 35eb8f112c88
child 31780 8d9eafe01111
equal deleted inserted replaced
31778:ac69675fff1c 31779:fd687ec5a643
   234     elif util.safehasattr(obj, '__iter__'):
   234     elif util.safehasattr(obj, '__iter__'):
   235         out = []
   235         out = []
   236         for i in obj:
   236         for i in obj:
   237             out.append(json(i))
   237             out.append(json(i))
   238         return '[' + ', '.join(out) + ']'
   238         return '[' + ', '.join(out) + ']'
   239     elif util.safehasattr(obj, '__call__'):
       
   240         return json(obj())
       
   241     else:
   239     else:
   242         raise TypeError('cannot encode type %s' % obj.__class__.__name__)
   240         raise TypeError('cannot encode type %s' % obj.__class__.__name__)
   243 
   241 
   244 @templatefilter('lower')
   242 @templatefilter('lower')
   245 def lower(text):
   243 def lower(text):