forked from searxng/searxng
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] hostnames plugin: add fallback for old hostname_replace pl…
…ugin Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
- Loading branch information
Showing
2 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
# pylint: disable=missing-module-docstring | ||
|
||
from flask_babel import gettext | ||
from searx.plugins import logger | ||
|
||
name = gettext('Hostname replace') | ||
description = "Deprecated / contact system admin to configure 'Hostnames plugin'!!" | ||
default_on = False | ||
preference_section = 'general' | ||
|
||
plugin_id = 'hostname_replace' | ||
logger = logger.getChild(plugin_id) | ||
|
||
REPORTED = False | ||
|
||
|
||
def deprecated_msg(): | ||
global REPORTED # pylint: disable=global-statement | ||
if REPORTED: | ||
return | ||
logger.error( | ||
"'Hostname replace' plugin is deprecated and will be dropped soon!" | ||
" Configure 'Hostnames plugin':" | ||
" https://docs.searxng.org/src/searx.plugins.hostnames.html" | ||
) | ||
REPORTED = True | ||
|
||
|
||
def on_result(_request, _search, result): | ||
# pylint: disable=import-outside-toplevel, cyclic-import | ||
from searx.plugins.hostnames import on_result as hostnames_on_result | ||
|
||
deprecated_msg() | ||
return hostnames_on_result(_request, _search, result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters