mercurial/templatefilters.py
changeset 50609 90945014f4e4
parent 50608 046b9cce5850
child 50928 d718eddf01d9
equal deleted inserted replaced
50608:046b9cce5850 50609:90945014f4e4
   344             b'"%s": %s'
   344             b'"%s": %s'
   345             % (encoding.jsonescape(k, paranoid=paranoid), json(v, paranoid))
   345             % (encoding.jsonescape(k, paranoid=paranoid), json(v, paranoid))
   346             for k, v in sorted(obj.items())
   346             for k, v in sorted(obj.items())
   347         ]
   347         ]
   348         return b'{' + b', '.join(out) + b'}'
   348         return b'{' + b', '.join(out) + b'}'
   349     elif util.safehasattr(obj, b'__iter__'):
   349     elif util.safehasattr(obj, '__iter__'):
   350         out = [json(i, paranoid) for i in obj]
   350         out = [json(i, paranoid) for i in obj]
   351         return b'[' + b', '.join(out) + b']'
   351         return b'[' + b', '.join(out) + b']'
   352     raise error.ProgrammingError(b'cannot encode %r' % obj)
   352     raise error.ProgrammingError(b'cannot encode %r' % obj)
   353 
   353 
   354 
   354