##// END OF EJS Templates
templater: make it clearer that _flatten() omits None
Yuya Nishihara -
r29815:0d5cc0c1 default
parent child Browse files
Show More
@@ -917,17 +917,19 def _flatten(thing):
917 '''yield a single stream from a possibly nested set of iterators'''
917 '''yield a single stream from a possibly nested set of iterators'''
918 if isinstance(thing, str):
918 if isinstance(thing, str):
919 yield thing
919 yield thing
920 elif thing is None:
921 pass
920 elif not util.safehasattr(thing, '__iter__'):
922 elif not util.safehasattr(thing, '__iter__'):
921 if thing is not None:
922 yield str(thing)
923 yield str(thing)
923 else:
924 else:
924 for i in thing:
925 for i in thing:
925 if isinstance(i, str):
926 if isinstance(i, str):
926 yield i
927 yield i
928 elif i is None:
929 pass
927 elif not util.safehasattr(i, '__iter__'):
930 elif not util.safehasattr(i, '__iter__'):
928 if i is not None:
929 yield str(i)
931 yield str(i)
930 elif i is not None:
932 else:
931 for j in _flatten(i):
933 for j in _flatten(i):
932 yield j
934 yield j
933
935
General Comments 0
You need to be logged in to leave comments. Login now