summaryrefslogtreecommitdiff
path: root/searx/engines/__init__.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2026-06-16 10:31:21 +0200
committerGitHub <noreply@github.com>2026-06-16 10:31:21 +0200
commit4fb49b44988b0c2e9f323e0526f0c9c2bb8dfa2d (patch)
tree5c05b3d828ed8fdcc403cc6df9caa201c65e39c6 /searx/engines/__init__.py
parentcf1410af8d794793c8af02b97d3e1cf3bc7a7dda (diff)
[chore] add DeprecationWarning for obsolete engine.about.language property (#6265)
The old property should still be supported for a transitional period; the reasons for this can be seen from the discussion in [1] / the further procedure is also discussed there. [1] https://github.com/searxng/searxng/issues/6261 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/__init__.py')
-rw-r--r--searx/engines/__init__.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py
index 6713aebd1..4175c9414 100644
--- a/searx/engines/__init__.py
+++ b/searx/engines/__init__.py
@@ -14,6 +14,7 @@ import sys
import copy
import os
from os.path import realpath, dirname
+import warnings
import types
import inspect
@@ -184,8 +185,9 @@ def set_loggers(engine: "Engine|types.ModuleType", engine_name: str):
def update_engine_attributes(engine: "Engine | types.ModuleType", engine_data: dict[str, t.Any]):
- # set engine attributes from engine_data
+ # pylint: disable=too-many-branches
+ # set engine attributes from engine_data
kvargs: dict[str, t.Any]
if isinstance(engine.about, EngineAbout):
kvargs = {**msgspec.to_builtins(engine.about), **engine_data.get("about", {})}
@@ -199,6 +201,18 @@ def update_engine_attributes(engine: "Engine | types.ModuleType", engine_data: d
f"engine '{engine_data['name']}' ({engine_data['engine']}) - in the about section --> {exc}"
) from exc
+ # warn about deprecated engine settings
+
+ if engine.about.language:
+ if hasattr(engine, "language") and not engine.language:
+ engine.language = engine.about.language
+ warnings.warn(
+ f"engine '{engine_data['name']}' ({engine_data['engine']})"
+ f" - migrate engine.about.language to engine.language!",
+ DeprecationWarning,
+ 2,
+ )
+
for param_name, param_value in engine_data.items():
if param_name == "about":
continue