Merge pull request #2289 from dalf/pylint

[mod] pylint: add extension-pkg-whitelist=lxml.etree
This commit is contained in:
Alexandre Flament 2020-11-14 13:24:31 +01:00 committed by GitHub
commit 102c08838b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 11 deletions

View file

@ -12,7 +12,7 @@
# A comma-separated list of package or module names from where C extensions may # A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may # be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code # run arbitrary code
extension-pkg-whitelist= extension-pkg-whitelist=lxml.etree
# Add files or directories to the blacklist. They should be base names, not # Add files or directories to the blacklist. They should be base names, not
# paths. # paths.

View file

@ -17,7 +17,7 @@ from searx.utils import html_to_text, match_language
# engine dependent config # engine dependent config
categories = None categories = []
paging = True paging = True
language_support = True language_support = True
supported_languages_url = 'https://qwant.com/region' supported_languages_url = 'https://qwant.com/region'

View file

@ -7,6 +7,7 @@ url_xpath = None
content_xpath = None content_xpath = None
title_xpath = None title_xpath = None
thumbnail_xpath = False thumbnail_xpath = False
categories = []
paging = False paging = False
suggestion_xpath = '' suggestion_xpath = ''
results_xpath = '' results_xpath = ''

View file

@ -44,7 +44,7 @@ from urllib.parse import urlencode, urlparse, urljoin, urlsplit
from pygments import highlight from pygments import highlight
from pygments.lexers import get_lexer_by_name from pygments.lexers import get_lexer_by_name
from pygments.formatters import HtmlFormatter from pygments.formatters import HtmlFormatter # pylint: disable=no-name-in-module
from werkzeug.middleware.proxy_fix import ProxyFix from werkzeug.middleware.proxy_fix import ProxyFix
from flask import ( from flask import (
@ -111,7 +111,7 @@ app = Flask(
app.jinja_env.trim_blocks = True app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True app.jinja_env.lstrip_blocks = True
app.jinja_env.add_extension('jinja2.ext.loopcontrols') app.jinja_env.add_extension('jinja2.ext.loopcontrols') # pylint: disable=no-member
app.secret_key = settings['server']['secret_key'] app.secret_key = settings['server']['secret_key']
# see https://flask.palletsprojects.com/en/1.1.x/cli/ # see https://flask.palletsprojects.com/en/1.1.x/cli/
@ -589,14 +589,11 @@ def search():
result_container = search.search() result_container = search.search()
except Exception as e: except SearxParameterException as e:
# log exception logger.exception('search error: SearxParameterException')
logger.exception('search error')
# is it an invalid input parameter or something else ?
if (issubclass(e.__class__, SearxParameterException)):
return index_error(output_format, e.message), 400 return index_error(output_format, e.message), 400
else: except Exception as e:
logger.exception('search error')
return index_error(output_format, gettext('search error')), 500 return index_error(output_format, gettext('search error')), 500
# results # results