mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +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:
parent
f219493365
commit
b641bb8ce8
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user