From 56b3cf07fff4d3794dcdbf99f6d7faa629fa243e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=9D=CE=B9=CE=BA=CF=8C=CE=BB=CE=B1=CE=BF=CF=82-=CE=94?= =?UTF-8?q?=CE=B9=CE=B3=CE=B5=CE=BD=CE=AE=CF=82=20=CE=9A=CE=B1=CF=81=CE=B1?= =?UTF-8?q?=CE=B3=CE=B9=CE=AC=CE=BD=CE=BD=CE=B7=CF=82?= Date: Wed, 6 May 2015 22:36:14 +0300 Subject: [PATCH] fix string manipulation in render_templatefile() --- scrapy/utils/template.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scrapy/utils/template.py b/scrapy/utils/template.py index 1cfcd82ee..90aa8f705 100644 --- a/scrapy/utils/template.py +++ b/scrapy/utils/template.py @@ -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)