aboutsummaryrefslogtreecommitdiffstats
path: root/mako
diff options
context:
space:
mode:
authorlacsaP <patatetom@users.noreply.github.com>2017-11-15 14:14:29 +0100
committerMike Bayer <mike_mp@zzzcomputing.com>2017-11-15 10:04:58 -0500
commitc480854e334a225812dd43582b28a48ee57aa9b5 (patch)
treeb1349c663ca841fd603b82d8d525771bca34d445 /mako
parente63e7787eea3e1c1fb39ae7e1672b0202f0fb9c6 (diff)
downloadexternal_python_mako-c480854e334a225812dd43582b28a48ee57aa9b5.tar.gz
external_python_mako-c480854e334a225812dd43582b28a48ee57aa9b5.tar.bz2
external_python_mako-c480854e334a225812dd43582b28a48ee57aa9b5.zip
Add --output-encoding to mako-render
Fixes: #271 Change-Id: I88b46cfbdea9eda0b4c478dd97829bee8431ff58
Diffstat (limited to 'mako')
-rw-r--r--mako/__init__.py2
-rwxr-xr-xmako/cmd.py10
2 files changed, 9 insertions, 3 deletions
diff --git a/mako/__init__.py b/mako/__init__.py
index 01c1739..a73ab1e 100644
--- a/mako/__init__.py
+++ b/mako/__init__.py
@@ -5,4 +5,4 @@
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-__version__ = '1.0.7'
+__version__ = '1.0.8'
diff --git a/mako/cmd.py b/mako/cmd.py
index 8db1346..609b4c9 100755
--- a/mako/cmd.py
+++ b/mako/cmd.py
@@ -35,14 +35,20 @@ def cmdline(argv=None):
"template is read from stdin, the value defaults to be "
"the current directory, otherwise it defaults to be the "
"parent directory of the file provided.")
+ parser.add_argument(
+ "--output-encoding", default=None,
+ help="force output encoding")
parser.add_argument('input', nargs='?', default='-')
options = parser.parse_args(argv)
+
+ output_encoding = options.output_encoding
+
if options.input == '-':
lookup_dirs = options.template_dir or ["."]
lookup = TemplateLookup(lookup_dirs)
try:
- template = Template(sys.stdin.read(), lookup=lookup)
+ template = Template(sys.stdin.read(), lookup=lookup, output_encoding=output_encoding)
except:
_exit()
else:
@@ -52,7 +58,7 @@ def cmdline(argv=None):
lookup_dirs = options.template_dir or [dirname(filename)]
lookup = TemplateLookup(lookup_dirs)
try:
- template = Template(filename=filename, lookup=lookup)
+ template = Template(filename=filename, lookup=lookup, output_encoding=output_encoding)
except:
_exit()