From 5d977056f7aa216eae09a22c3baaff73546f6ff1 Mon Sep 17 00:00:00 2001 From: Cqoicebordel Date: Mon, 29 Dec 2014 21:31:04 +0100 Subject: Flake8 and Twitter corrections Lots of Flake8 corrections Maybe we should change the rule to allow lines of 120 chars. It seems more usable. Big twitter correction : now it outputs the words in right order... --- searx/engines/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'searx/engines/__init__.py') diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py index d42339af8..9bc5cdfd4 100644 --- a/searx/engines/__init__.py +++ b/searx/engines/__init__.py @@ -81,7 +81,7 @@ 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}"'\ + print('[E] Engine config error: Missing attribute "{0}.{1}"' .format(engine.name, engine_attr)) sys.exit(1) @@ -102,7 +102,7 @@ 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}'\ + print('[E] Engine config error: ambigious shortcut: {0}' .format(engine.shortcut)) sys.exit(1) engine_shortcuts[engine.shortcut] = engine.name -- cgit v1.2.3 From 299a80a1eb2eecb80f5c50da261a9eab1900b572 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Fri, 9 Jan 2015 04:13:05 +0100 Subject: [enh] using the logger --- searx/engines/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'searx/engines/__init__.py') diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py index 9bc5cdfd4..643b107a5 100644 --- a/searx/engines/__init__.py +++ b/searx/engines/__init__.py @@ -22,6 +22,10 @@ from imp import load_source from flask.ext.babel import gettext from operator import itemgetter from searx import settings +from searx import logger + + +logger = logger.getChild('engines') engine_dir = dirname(realpath(__file__)) @@ -81,7 +85,7 @@ 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}"' + logger.error('Missing engine config attribute: "{0}.{1}"' .format(engine.name, engine_attr)) sys.exit(1) @@ -100,9 +104,8 @@ def load_engine(engine_data): categories['general'].append(engine) if engine.shortcut: - # TODO check duplications if engine.shortcut in engine_shortcuts: - print('[E] Engine config error: ambigious shortcut: {0}' + logger.error('Engine config error: ambigious shortcut: {0}' .format(engine.shortcut)) sys.exit(1) engine_shortcuts[engine.shortcut] = engine.name @@ -199,7 +202,7 @@ def get_engines_stats(): if 'engines' not in settings or not settings['engines']: - print '[E] Error no engines found. Edit your settings.yml' + logger.error('No engines found. Edit your settings.yml') exit(2) for engine_data in settings['engines']: -- cgit v1.2.3