Commit 5f97646a authored by Yusei Tahara's avatar Yusei Tahara

Local variable `template` is used for different things, it is bad. Use...

Local variable `template` is used for different things, it is bad. Use different variable name for different thing.
parent da56e813
......@@ -217,23 +217,23 @@ class Recipe(object):
compiled_source = env.compile(source, filename=template)
else:
try:
compiled_source = compiled_source_cache[self.template]
compiled_source = compiled_source_cache[template]
except KeyError:
template = zc.buildout.download.Download(
download_path = zc.buildout.download.Download(
self.buildout['buildout'],
hash_name=True,
)(
template,
md5sum=self.md5sum,
)[0]
with open(template, 'rb') as f:
with open(download_path, 'rb') as f:
source = f.read().decode(self.encoding)
compiled_source_cache[self.template] = compiled_source = env.compile(source, filename=template)
compiled_source_cache[template] = compiled_source = env.compile(source, filename=download_path)
template = env.template_class.from_code(env,
template_object = env.template_class.from_code(env,
compiled_source,
env.make_globals(None), None)
rendered = template.render(**self.context).encode(self.encoding)
rendered = template_object.render(**self.context).encode(self.encoding)
mode = self.mode
mask = (0o777 if rendered.startswith(b'#!') else 0o666
) if mode is None else 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment