0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 09:33:54 +01:00

Tolerate sites where all pages are private (#3974)

When all pages on a site is private, the last_mods set will be empty
causing a crash when trying to get the max value from it.
This fix adds a test that the set is truthy (not empty) before calling
max.
This commit is contained in:
Stein Strindhaug 2017-10-26 12:53:05 +02:00 committed by Karl Hobley
parent f219493365
commit b641bb8ce8

View File

@ -35,6 +35,7 @@ class Sitemap(DjangoSitemap):
urls.append(url_info)
last_mods.add(url_info.get('lastmod'))
if None not in last_mods:
# last_mods might be empty if the whole site is private
if last_mods and None not in last_mods:
self.latest_lastmod = max(last_mods)
return urls