[fix] set language_support for engines with languages in traits (#6258)

In the past, the engine option ``language_support`` was not consistently
maintained; with this patch, a ValueError is now thrown if an engine has
languages in its traits but language_support is not set to True.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser
2026-06-15 08:25:36 +02:00
committed by Markus Heiser
parent 6c9dcd4242
commit cf1410af8d
21 changed files with 25 additions and 2 deletions
+5 -2
View File
@@ -21,7 +21,7 @@ import msgspec
from searx import logger, settings
from searx.utils import load_module
from searx.data import ENGINE_TRAITS
from searx.enginelib import Engine, EngineAbout
logger = logger.getChild('engines')
@@ -196,7 +196,7 @@ def update_engine_attributes(engine: "Engine | types.ModuleType", engine_data: d
engine.about = EngineAbout(**kvargs)
except TypeError as exc:
raise TypeError(
f"engine {engine_data['name']} ({engine_data['engine']}) - in the about section --> {exc}"
f"engine '{engine_data['name']}' ({engine_data['engine']}) - in the about section --> {exc}"
) from exc
for param_name, param_value in engine_data.items():
@@ -214,6 +214,9 @@ def update_engine_attributes(engine: "Engine | types.ModuleType", engine_data: d
if not hasattr(engine, arg_name):
setattr(engine, arg_name, copy.deepcopy(arg_value))
if ENGINE_TRAITS.get(engine.name, {}).get("languages") and not engine.language_support:
raise ValueError(f"engine '{engine.name}' ({engine_data['engine']}) language_support should be set to True")
def update_attributes_for_tor(engine: "Engine | types.ModuleType"):
if using_tor_proxy(engine) and hasattr(engine, 'onion_url'):