Implement "get_file_contents" helper

This commit is contained in:
Ivan Kravets
2018-12-27 14:48:22 +02:00
parent 74218f4f93
commit aa2bc4a63b
5 changed files with 17 additions and 15 deletions

View File

@@ -122,10 +122,8 @@ class ProjectGenerator(object):
contents.encode("utf8") if util.PY2 else contents)
def _render_tpl(self, tpl_path):
content = ""
with open(tpl_path) as f:
content = f.read()
return bottle.template(content, **self._tplvars)
return bottle.template(
util.get_file_contents(tpl_path), **self._tplvars)
@staticmethod
def _merge_contents(dst_path, contents):