##// END OF EJS Templates
templater: remove cStringIO from stringify
Matt Mackall -
r3634:6a46c9cc default
parent child Browse files
Show More
@@ -172,15 +172,14 b' def age(date):'
172
172
173 def stringify(thing):
173 def stringify(thing):
174 '''turn nested template iterator into string.'''
174 '''turn nested template iterator into string.'''
175 cs = cStringIO.StringIO()
175 def flatten(thing):
176 def walk(things):
176 if hasattr(thing, '__iter__'):
177 for t in things:
177 for t in thing:
178 if hasattr(t, '__iter__'):
178 for i in flatten(t):
179 walk(t)
179 yield i
180 else:
180 else:
181 cs.write(t)
181 yield str(thing)
182 walk(thing)
182 return "".join(flatten(thing))
183 return cs.getvalue()
184
183
185 para_re = None
184 para_re = None
186 space_re = None
185 space_re = None
General Comments 0
You need to be logged in to leave comments. Login now