mirror of https://github.com/searx/searx
[enh] engine shortcut validation
This commit is contained in:
parent
7eb27848c2
commit
2e41bfcbdb
|
@ -81,7 +81,8 @@ def load_engine(engine_data):
|
||||||
if engine_attr.startswith('_'):
|
if engine_attr.startswith('_'):
|
||||||
continue
|
continue
|
||||||
if getattr(engine, engine_attr) is None:
|
if getattr(engine, engine_attr) is None:
|
||||||
print '[E] Engine config error: Missing attribute "{0}.{1}"'.format(engine.name, engine_attr) # noqa
|
print('[E] Engine config error: Missing attribute "{0}.{1}"'\
|
||||||
|
.format(engine.name, engine_attr))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
engine.stats = {
|
engine.stats = {
|
||||||
|
@ -100,6 +101,10 @@ def load_engine(engine_data):
|
||||||
|
|
||||||
if engine.shortcut:
|
if engine.shortcut:
|
||||||
# TODO check duplications
|
# TODO check duplications
|
||||||
|
if engine.shortcut in engine_shortcuts:
|
||||||
|
print('[E] Engine config error: ambigious shortcut: {0}'\
|
||||||
|
.format(engine.shortcut))
|
||||||
|
sys.exit(1)
|
||||||
engine_shortcuts[engine.shortcut] = engine.name
|
engine_shortcuts[engine.shortcut] = engine.name
|
||||||
return engine
|
return engine
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue