1
0
mirror of https://github.com/searx/searx synced 2024-12-01 14:40:43 +01:00

[enh] basic config check

This commit is contained in:
asciimoo 2013-10-25 23:41:14 +02:00
parent 5dcddbc0ab
commit 34bdeda6d4

View File

@ -56,6 +56,12 @@ for section in engines_config.sections():
engine.categories = map(str.strip, engines_config.get(section, param_name).split(',')) engine.categories = map(str.strip, engines_config.get(section, param_name).split(','))
continue continue
setattr(engine, param_name, engines_config.get(section, param_name)) setattr(engine, param_name, engines_config.get(section, param_name))
for engine_attr in dir(engine):
if engine_attr.startswith('_'):
continue
if getattr(engine, engine_attr) == None:
print '[E] Engine config error: Missing attribute "{0}.{1}"'.format(engine.name, engine_attr)
sys.exit(1)
engines[engine.name] = engine engines[engine.name] = engine
if hasattr(engine, 'categories'): if hasattr(engine, 'categories'):
for category_name in engine.categories: for category_name in engine.categories: