summaryrefslogtreecommitdiff
path: root/searx/engines/__init__.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2014-12-20 12:17:03 +0100
committerAdam Tauber <asciimoo@gmail.com>2014-12-20 12:17:03 +0100
commit2e41bfcbdbb762be610ff379380ea2201f544edd (patch)
treeba49f20e766d29ce6912065ba3e67f19b0318d03 /searx/engines/__init__.py
parent7eb27848c2beaa4b5737cc1d52480c510548a21e (diff)
downloadsearxng-2e41bfcbdbb762be610ff379380ea2201f544edd.tar.gz
searxng-2e41bfcbdbb762be610ff379380ea2201f544edd.zip
[enh] engine shortcut validation
Diffstat (limited to 'searx/engines/__init__.py')
-rw-r--r--searx/engines/__init__.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py
index 3c9ce3b57..d42339af8 100644
--- a/searx/engines/__init__.py
+++ b/searx/engines/__init__.py
@@ -81,7 +81,8 @@ def load_engine(engine_data):
if engine_attr.startswith('_'):
continue
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)
engine.stats = {
@@ -100,6 +101,10 @@ def load_engine(engine_data):
if engine.shortcut:
# 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
return engine