forked from zaclys/searxng
infopage: a .md file can be remove without crash
An administrator might decide to remove some of the .md files. This commit make sure to not crash the application.
This commit is contained in:
parent
eb3123e164
commit
ecccf02a02
|
@ -157,10 +157,9 @@ class InfoPageSet: # pylint: disable=too-few-public-methods
|
||||||
return None
|
return None
|
||||||
|
|
||||||
cache_key = (pagename, locale)
|
cache_key = (pagename, locale)
|
||||||
page = self.CACHE.get(cache_key)
|
|
||||||
|
|
||||||
if page is not None:
|
if cache_key in self.CACHE:
|
||||||
return page
|
return self.CACHE[cache_key]
|
||||||
|
|
||||||
# not yet instantiated
|
# not yet instantiated
|
||||||
|
|
||||||
|
@ -183,4 +182,6 @@ class InfoPageSet: # pylint: disable=too-few-public-methods
|
||||||
if fallback_to_default and page is None:
|
if fallback_to_default and page is None:
|
||||||
page_locale = self.locale_default
|
page_locale = self.locale_default
|
||||||
page = self.get_page(page_name, self.locale_default)
|
page = self.get_page(page_name, self.locale_default)
|
||||||
|
if page is not None:
|
||||||
|
# page is None if the page was deleted by the administrator
|
||||||
yield page_name, page_locale, page
|
yield page_name, page_locale, page
|
||||||
|
|
Loading…
Reference in New Issue