mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-20 21:11:55 +00: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
8d421fd84f
commit
f65d961ae0
1 changed files with 2 additions and 1 deletions
|
|
@ -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 a new issue