mercurial/templater.py
changeset 32974 8779d35c168d
parent 32970 11c0bb4ccc76
child 33016 4e6dc34b5d7a
equal deleted inserted replaced
32973:20ca19e6c74e 32974:8779d35c168d
  1104     if isinstance(thing, bytes):
  1104     if isinstance(thing, bytes):
  1105         yield thing
  1105         yield thing
  1106     elif thing is None:
  1106     elif thing is None:
  1107         pass
  1107         pass
  1108     elif not util.safehasattr(thing, '__iter__'):
  1108     elif not util.safehasattr(thing, '__iter__'):
  1109         yield str(thing)
  1109         yield pycompat.bytestr(thing)
  1110     else:
  1110     else:
  1111         for i in thing:
  1111         for i in thing:
  1112             i = templatekw.unwraphybrid(i)
  1112             i = templatekw.unwraphybrid(i)
  1113             if isinstance(i, bytes):
  1113             if isinstance(i, bytes):
  1114                 yield i
  1114                 yield i
  1115             elif i is None:
  1115             elif i is None:
  1116                 pass
  1116                 pass
  1117             elif not util.safehasattr(i, '__iter__'):
  1117             elif not util.safehasattr(i, '__iter__'):
  1118                 yield str(i)
  1118                 yield pycompat.bytestr(i)
  1119             else:
  1119             else:
  1120                 for j in _flatten(i):
  1120                 for j in _flatten(i):
  1121                     yield j
  1121                     yield j
  1122 
  1122 
  1123 def unquotestring(s):
  1123 def unquotestring(s):