diff options
author | Alexandre FLAMENT <alexandre.flament@hesge.ch> | 2022-06-29 17:25:07 +0000 |
---|---|---|
committer | Alexandre FLAMENT <alexandre.flament@hesge.ch> | 2022-06-29 17:25:07 +0000 |
commit | ecccf02a02122431bf1bdb566c0b7645d95f9409 (patch) | |
tree | ce651ce46f1ae4503cd52a5102ca5bd6b8c0ba63 | |
parent | eb3123e164903fa36b299e6f2902445386aea6ac (diff) | |
download | searxng-ecccf02a02122431bf1bdb566c0b7645d95f9409.tar.gz searxng-ecccf02a02122431bf1bdb566c0b7645d95f9409.zip |
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.
-rw-r--r-- | searx/infopage/__init__.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/searx/infopage/__init__.py b/searx/infopage/__init__.py index 730d50a74..6b8fd9133 100644 --- a/searx/infopage/__init__.py +++ b/searx/infopage/__init__.py @@ -157,10 +157,9 @@ class InfoPageSet: # pylint: disable=too-few-public-methods return None cache_key = (pagename, locale) - page = self.CACHE.get(cache_key) - if page is not None: - return page + if cache_key in self.CACHE: + return self.CACHE[cache_key] # not yet instantiated @@ -183,4 +182,6 @@ class InfoPageSet: # pylint: disable=too-few-public-methods if fallback_to_default and page is None: page_locale = self.locale_default page = self.get_page(page_name, self.locale_default) - yield page_name, page_locale, page + if page is not None: + # page is None if the page was deleted by the administrator + yield page_name, page_locale, page |