Tweak how 'env' is added to context for mako template upload
This commit is contained in:
parent
f20c7e4b52
commit
2393374923
|
@ -137,10 +137,14 @@ def upload_mako_template(local_path, remote_path, context={}, encoding='utf_8',
|
|||
"""
|
||||
template = Template(filename=local_path)
|
||||
|
||||
# make copy of context; add env to it
|
||||
context = dict(context)
|
||||
context['env'] = env
|
||||
|
||||
temp_dir = tempfile.mkdtemp(prefix='rattail-fabric.')
|
||||
temp_path = os.path.join(temp_dir, os.path.basename(local_path))
|
||||
with open(temp_path, 'wb') as f:
|
||||
text = template.render(env=env, **context)
|
||||
text = template.render(**context)
|
||||
f.write(text.encode(encoding))
|
||||
os.chmod(temp_path, os.stat(local_path).st_mode)
|
||||
|
||||
|
|
Loading…
Reference in a new issue