From 037a95e7302d4a8d3dae1d4ad64a879ecd64791b Mon Sep 17 00:00:00 2001 From: Yves Chevallier Date: Thu, 15 Jun 2017 10:06:14 -0400 Subject: Use sys.stdout.write instead of print in cmdline The `print` function adds an unwanted `\n` char. Change-Id: I4e345214352f0925c374145f41be45550da27393 Pull-request: https://github.com/zzzeek/mako/pull/23 --- doc/build/changelog.rst | 8 ++++++++ mako/cmd.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/build/changelog.rst b/doc/build/changelog.rst index 4df879f..38bef1c 100644 --- a/doc/build/changelog.rst +++ b/doc/build/changelog.rst @@ -8,6 +8,14 @@ Changelog .. changelog:: :version: 1.0.7 + .. change:: + :tags: bug + + Changed the "print" in the mako-render command to + sys.stdout.write(), avoiding the extra newline at the end + of the template output. Pull request courtesy + Yves Chevallier. + .. changelog:: :version: 1.0.6 :released: Wed Nov 9 2016 diff --git a/mako/cmd.py b/mako/cmd.py index dd1f833..8db1346 100755 --- a/mako/cmd.py +++ b/mako/cmd.py @@ -58,7 +58,7 @@ def cmdline(argv=None): kw = dict([varsplit(var) for var in options.var]) try: - print(template.render(**kw)) + sys.stdout.write(template.render(**kw)) except: _exit() -- cgit v1.2.3