mirror of
https://github.com/searxng/searxng.git
synced 2024-11-27 13:21:04 +00:00
[fix] do not load engines which cannot be initialized - closes #585
This commit is contained in:
parent
3a9c3fbd68
commit
54d987636e
1 changed files with 7 additions and 2 deletions
|
@ -57,7 +57,11 @@ def load_module(filename):
|
||||||
|
|
||||||
def load_engine(engine_data):
|
def load_engine(engine_data):
|
||||||
engine_name = engine_data['engine']
|
engine_name = engine_data['engine']
|
||||||
|
try:
|
||||||
engine = load_module(engine_name + '.py')
|
engine = load_module(engine_name + '.py')
|
||||||
|
except:
|
||||||
|
logger.exception('Cannot load engine "{}"'.format(engine_name))
|
||||||
|
return None
|
||||||
|
|
||||||
for param_name in engine_data:
|
for param_name in engine_data:
|
||||||
if param_name == 'engine':
|
if param_name == 'engine':
|
||||||
|
@ -199,4 +203,5 @@ if 'engines' not in settings or not settings['engines']:
|
||||||
|
|
||||||
for engine_data in settings['engines']:
|
for engine_data in settings['engines']:
|
||||||
engine = load_engine(engine_data)
|
engine = load_engine(engine_data)
|
||||||
|
if engine is not None:
|
||||||
engines[engine.name] = engine
|
engines[engine.name] = engine
|
||||||
|
|
Loading…
Reference in a new issue