Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 32e93e2

Browse files
committedSep 7, 2015
Prevent running scan_locs() more than once
1 parent f425710 commit 32e93e2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎nikola/plugins/task/sitemap/__init__.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ def gen_tasks(self):
140140
urlset = {}
141141

142142
def scan_locs():
143+
# No need to run this more than once
144+
if urlset:
145+
return True
143146
"""Scan site locations."""
144147
for root, dirs, files in os.walk(output, followlinks=True):
145148
if not dirs and not files and not kw['sitemap_include_fileless_dirs']:
@@ -290,6 +293,8 @@ def scan_locs_task():
290293

291294
return {'file_dep': file_dep}
292295

296+
scan_locs()
297+
293298
yield {
294299
"basename": "_scan_locs",
295300
"name": "sitemap",
@@ -298,8 +303,6 @@ def scan_locs_task():
298303

299304
yield self.group_task()
300305

301-
scan_locs()
302-
303306
for sitemap_path in sorted(urlset.keys()):
304307
# TODO: Fix issue #1683
305308
sitemap = urlset[sitemap_path]

0 commit comments

Comments
 (0)
Please sign in to comment.