1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-20 03:10:10 +01:00

[fix] do not allow underscore in engine names - closes #708

This commit is contained in:
Adam Tauber 2016-09-28 22:30:05 +02:00
parent bee7b497a3
commit 86daef2063
2 changed files with 10 additions and 4 deletions

View File

@ -57,11 +57,17 @@ def load_module(filename):
def load_engine(engine_data): def load_engine(engine_data):
engine_name = engine_data['engine']
if '_' in engine_data['name']:
logger.error('Engine name conains underscore: "{}"'.format(engine_data['name']))
sys.exit(1)
engine_module = engine_data['engine']
try: try:
engine = load_module(engine_name + '.py') engine = load_module(engine_module + '.py')
except: except:
logger.exception('Cannot load engine "{}"'.format(engine_name)) logger.exception('Cannot load engine "{}"'.format(engine_module))
return None return None
for param_name in engine_data: for param_name in engine_data:

View File

@ -377,7 +377,7 @@ engines:
timeout : 10.0 timeout : 10.0
disabled : True disabled : True
- name : scanr_structures - name : scanr structures
shortcut: scs shortcut: scs
engine : scanr_structures engine : scanr_structures
disabled : True disabled : True