From 4f9ed09ca18d5b6c45a86b72dd5b2a552e433afc Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 28 Sep 2014 10:15:17 +0000 Subject: [PATCH] serialize sitemap only once --- pandora/item/tasks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandora/item/tasks.py b/pandora/item/tasks.py index 035a19f9..4f4362be 100644 --- a/pandora/item/tasks.py +++ b/pandora/item/tasks.py @@ -195,7 +195,8 @@ def update_sitemap(base_url): priority = ET.SubElement(url, "priority") priority.text = '1.0' if t.status == 'featured' else '0.75' + data = '\n' + ET.tostring(urlset) with open(sitemap[:-3], 'wb') as f: - f.write('\n' + ET.tostring(urlset)) + f.write(data) with gzip.open(sitemap, 'wb') as f: - f.write('\n' + ET.tostring(urlset)) + f.write(data)