diff --git a/actions/searx b/actions/searx index 41681cba2..7af352bd7 100755 --- a/actions/searx +++ b/actions/searx @@ -1,5 +1,4 @@ #!/usr/bin/python3 -# -*- mode: python -*- # # This file is part of Plinth. # @@ -38,10 +37,10 @@ def parse_arguments(): parser = argparse.ArgumentParser() subparsers = parser.add_subparsers(dest='subcommand', help='Sub command') - subparsers.add_parser('enable', help='Enable searx') - subparsers.add_parser('disable', help='Disable searx') + subparsers.add_parser('enable', help='Enable Searx') + subparsers.add_parser('disable', help='Disable Searx') subparsers.add_parser( - 'setup', help="Perform post-installation operations for Searx") + 'setup', help='Perform post-installation operations for Searx') safe_search = subparsers.add_parser( 'set-safe-search', @@ -106,11 +105,13 @@ def subcommand_get_safe_search(_): def read_settings(): + """Load settings as dictionary from YAML config file.""" with open(SETTINGS_FILE, 'rb') as settings_file: return yaml.load(settings_file) def write_settings(settings): + """Write settings from dictionary to YAML config file.""" with open(SETTINGS_FILE, 'w') as settings_file: yaml.dump(settings, settings_file) diff --git a/plinth/modules/searx/__init__.py b/plinth/modules/searx/__init__.py index 8cfa63fdd..aa076146f 100644 --- a/plinth/modules/searx/__init__.py +++ b/plinth/modules/searx/__init__.py @@ -15,7 +15,7 @@ # along with this program. If not, see . # """ -FreedomBox module to configure Searx +FreedomBox app to configure Searx. """ import os @@ -44,7 +44,7 @@ name = _('Searx') short_description = _('Web Search') description = [ - _('Searx is a privacy-respecting internet metasearch engine. ' + _('Searx is a privacy-respecting Internet metasearch engine. ' 'It aggregrates and displays results from multiple search engines.'), _('Searx can be used to avoid tracking and profiling by search engines. ' 'It stores no cookies by default.') diff --git a/plinth/modules/searx/forms.py b/plinth/modules/searx/forms.py index 63bb9286b..89f95ddf5 100644 --- a/plinth/modules/searx/forms.py +++ b/plinth/modules/searx/forms.py @@ -15,7 +15,7 @@ # along with this program. If not, see . # """ -Plinth form for configuring Searx. +Django form for configuring Searx. """ from django import forms diff --git a/plinth/modules/searx/views.py b/plinth/modules/searx/views.py index db2b7334a..309bb75f7 100644 --- a/plinth/modules/searx/views.py +++ b/plinth/modules/searx/views.py @@ -15,7 +15,7 @@ # along with this program. If not, see . # """ -Plinth views for Searx. +Django views for Searx. """ from django.contrib import messages @@ -51,13 +51,10 @@ class SearxServiceView(views.ServiceView): if str(old_data['safe_search']) != form_data['safe_search']: try: actions.superuser_run( - 'searx', - ['set-safe-search', - str(form_data['safe_search'])]) - messages.success(self.request, - _('Safe search setting updated')) + 'searx', ['set-safe-search', form_data['safe_search']]) + messages.success(self.request, _('Configuration updated.')) except ActionError as e: messages.error(self.request, - _('Failed to update safe search setting')) + _('An error occurred during configuration.')) return super().form_valid(form)