1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-24 23:43:59 +00:00

fix string manipulation in render_templatefile()

This commit is contained in:
Νικόλαος-Διγενής Καραγιάννης 2015-05-06 22:36:14 +03:00
parent f5c54072ec
commit 56b3cf07ff

View File

@ -10,7 +10,8 @@ def render_templatefile(path, **kwargs):
content = string.Template(raw).substitute(**kwargs)
with open(path.rstrip('.tmpl'), 'wb') as file:
render_path = path[:-len('.tmpl')] if path.endswith('.tmpl') else path
with open(render_path, 'wb') as file:
file.write(content)
if path.endswith('.tmpl'):
os.remove(path)