on master help sign in
Merge pull request #2289 from dalf/pylint

[mod] pylint: add extension-pkg-whitelist=lxml.etree

commit102c08838b4f4afe044d8eafcc0de635f1401d35 authorAlexandre Flament <alex@al-f.net> dateSat 14 Nov 2020, 13:24 (6 years ago) parent46b454258d72f2
4 files changed+9−11
.pylintrc+1−1 searx/engines/qwant.py+1−1 searx/engines/xpath.py+1 searx/webapp.py+6−9
.pylintrc+1−1
@@ -12,7 +12,7 @@
1212# A comma-separated list of package or module names from where C extensions may
1313# be loaded. Extensions are loading into the active Python interpreter and may
1414# run arbitrary code
15−extension-pkg-whitelist=
15+extension-pkg-whitelist=lxml.etree
1616
1717# Add files or directories to the blacklist. They should be base names, not
1818# paths.
searx/engines/qwant.py+1−1
@@ -17,7 +17,7 @@ from searx.utils import html_to_text, match_language
1717
1818
1919# engine dependent config
20−categories = None
20+categories = []
2121paging = True
2222language_support = True
2323supported_languages_url = 'https://qwant.com/region'
searx/engines/xpath.py+1
@@ -7,6 +7,7 @@ url_xpath = None
77content_xpath = None
88title_xpath = None
99thumbnail_xpath = False
10+categories = []
1011paging = False
1112suggestion_xpath = ''
1213results_xpath = ''
searx/webapp.py+6−9
@@ -44,7 +44,7 @@ from urllib.parse import urlencode, urlparse, urljoin, urlsplit
4444
4545from pygments import highlight
4646from pygments.lexers import get_lexer_by_name
47−from pygments.formatters import HtmlFormatter
47+from pygments.formatters import HtmlFormatter # pylint: disable=no-name-in-module
4848
4949from werkzeug.middleware.proxy_fix import ProxyFix
5050from flask import (
@@ -111,7 +111,7 @@ app = Flask(
111111
112112app.jinja_env.trim_blocks = True
113113app.jinja_env.lstrip_blocks = True
114−app.jinja_env.add_extension('jinja2.ext.loopcontrols')
114+app.jinja_env.add_extension('jinja2.ext.loopcontrols') # pylint: disable=no-member
115115app.secret_key = settings['server']['secret_key']
116116
117117# see https://flask.palletsprojects.com/en/1.1.x/cli/
@@ -589,15 +589,12 @@ def search():
589589
590590 result_container = search.search()
591591
592+ except SearxParameterException as e:
593+ logger.exception('search error: SearxParameterException')
594+ return index_error(output_format, e.message), 400
592595 except Exception as e:
593− # log exception
594596 logger.exception('search error')
595−
596− # is it an invalid input parameter or something else ?
597− if (issubclass(e.__class__, SearxParameterException)):
598− return index_error(output_format, e.message), 400
599− else:
600− return index_error(output_format, gettext('search error')), 500
597+ return index_error(output_format, gettext('search error')), 500
601598
602599 # results
603600 results = result_container.get_ordered_results()