From: Olivier Matz Date: Wed, 29 Aug 2012 22:10:57 +0000 (+0200) Subject: use 2 streams (input and output) instead of 1 in parse_from_memory() X-Git-Tag: v1.0~6 X-Git-Url: http://git.droids-corp.org/?p=diff2html.git;a=commitdiff_plain;h=7a6f9fb238e4a1a4a9533823db2618e2cd416f1e;hp=dd0649dbd5ba5463535a8a2cb4c2335a78e4fec6 use 2 streams (input and output) instead of 1 in parse_from_memory() The initial code was not well tested and according to Sergey it is not working properly. Signed-off-by: Sergey Satskiy Signed-off-by: Olivier Matz --- diff --git a/diff2html.py b/diff2html.py index 337667f..b361491 100644 --- a/diff2html.py +++ b/diff2html.py @@ -424,9 +424,11 @@ def main(): def parse_from_memory(txt, exclude_headers, show_hunk_infos): " Parses diff from memory and returns a string with html " - stream = StringIO.StringIO(txt) - parse_input(stream, stream, exclude_headers, show_hunk_infos) - return stream.buf + input_stream = StringIO.StringIO(txt) + output_stream = StringIO.StringIO() + parse_input(input_stream, output_stream, exclude_headers, show_hunk_infos) + return output_stream.getvalue() + if __name__ == "__main__": main()