# HG changeset patch # User Matt Mackall # Date 2006-11-13 19:26:57 # Node ID 6a46c9ccc2ede2fe0c7b485ec73c79b9ae75977b # Parent bf3dec184c78f5d74628d35b332a808a19f05b56 templater: remove cStringIO from stringify diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -172,15 +172,14 @@ def age(date): def stringify(thing): '''turn nested template iterator into string.''' - cs = cStringIO.StringIO() - def walk(things): - for t in things: - if hasattr(t, '__iter__'): - walk(t) - else: - cs.write(t) - walk(thing) - return cs.getvalue() + def flatten(thing): + if hasattr(thing, '__iter__'): + for t in thing: + for i in flatten(t): + yield i + else: + yield str(thing) + return "".join(flatten(thing)) para_re = None space_re = None