From d2993236e3710899c59d173029b1069d2d23b28d Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Fri, 27 Mar 2020 15:33:09 -0700 Subject: [PATCH] cosmetic: Minor yapf and other fixes Signed-off-by: Joseph Nuthalapati Reviewed-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/app.py | 3 +++ plinth/modules/gitweb/__init__.py | 1 + plinth/modules/radicale/__init__.py | 3 +++ plinth/modules/searx/__init__.py | 1 + plinth/modules/sharing/data/etc/plinth/modules-enabled/sharing | 2 +- plinth/modules/users/forms.py | 2 +- plinth/modules/users/tests/test_views.py | 1 + 7 files changed, 11 insertions(+), 2 deletions(-) diff --git a/plinth/app.py b/plinth/app.py index 27dd2e5e3..750f4033d 100644 --- a/plinth/app.py +++ b/plinth/app.py @@ -180,8 +180,10 @@ class Component: def enable(self): """Run operations to enable the component.""" + def disable(self): """Run operations to disable the component.""" + @staticmethod def diagnose(): """Run diagnostics and return results. @@ -258,6 +260,7 @@ class LeaderComponent(Component): class Info(FollowerComponent): """Component to capture basic information about an app.""" + def __init__(self, app_id, version, is_essential=False, depends=None, name=None, icon=None, icon_filename=None, short_description=None, description=None, manual_page=None, diff --git a/plinth/modules/gitweb/__init__.py b/plinth/modules/gitweb/__init__.py index c9f57d287..983a617b7 100644 --- a/plinth/modules/gitweb/__init__.py +++ b/plinth/modules/gitweb/__init__.py @@ -147,6 +147,7 @@ class GitwebApp(app_module.App): class GitwebWebserverAuth(Webserver): """Component to handle Gitweb authentication webserver configuration.""" + def is_conf_enabled(self): """Check whether Gitweb authentication configuration is enabled.""" return super().is_enabled() diff --git a/plinth/modules/radicale/__init__.py b/plinth/modules/radicale/__init__.py index e7d7d1a21..9dd6152e6 100644 --- a/plinth/modules/radicale/__init__.py +++ b/plinth/modules/radicale/__init__.py @@ -97,6 +97,7 @@ class RadicaleApp(app_module.App): class RadicaleWebserver(Webserver): """Webserver enable/disable behavior specific for radicale.""" + @property def web_name(self): """Return web configuration name based on radicale version.""" @@ -113,6 +114,7 @@ class RadicaleWebserver(Webserver): class RadicaleUwsgi(Uwsgi): """uWSGI enable/disable behavior specific for radicale.""" + def is_enabled(self): """Return whether the uWSGI configuration is enabled if version>=2.""" package_version = get_package_version() @@ -137,6 +139,7 @@ class RadicaleUwsgi(Uwsgi): class RadicaleDaemon(Daemon): """Daemon enable/disable behavior specific for radicale.""" + @staticmethod def _is_old_radicale(): """Return whether radicale is less than version 2.""" diff --git a/plinth/modules/searx/__init__.py b/plinth/modules/searx/__init__.py index 18ff6f50f..162865d45 100644 --- a/plinth/modules/searx/__init__.py +++ b/plinth/modules/searx/__init__.py @@ -92,6 +92,7 @@ class SearxApp(app_module.App): class SearxWebserverAuth(Webserver): """Component to handle Searx authentication webserver configuration.""" + def is_enabled(self): """Return if configuration is enabled or public access is enabled.""" return is_public_access_enabled() or super().is_enabled() diff --git a/plinth/modules/sharing/data/etc/plinth/modules-enabled/sharing b/plinth/modules/sharing/data/etc/plinth/modules-enabled/sharing index 7972c57cb..f8353f722 100644 --- a/plinth/modules/sharing/data/etc/plinth/modules-enabled/sharing +++ b/plinth/modules/sharing/data/etc/plinth/modules-enabled/sharing @@ -1 +1 @@ -plinth.modules.sharing \ No newline at end of file +plinth.modules.sharing diff --git a/plinth/modules/users/forms.py b/plinth/modules/users/forms.py index 19ea922af..55515febc 100644 --- a/plinth/modules/users/forms.py +++ b/plinth/modules/users/forms.py @@ -25,7 +25,7 @@ from . import get_last_admin_user from .components import UsersAndGroups -class ValidNewUsernameCheckMixin(object): +class ValidNewUsernameCheckMixin: """Mixin to check if a username is valid for created new user.""" def clean_username(self): diff --git a/plinth/modules/users/tests/test_views.py b/plinth/modules/users/tests/test_views.py index bc59deb80..97d717908 100644 --- a/plinth/modules/users/tests/test_views.py +++ b/plinth/modules/users/tests/test_views.py @@ -10,6 +10,7 @@ from django import urls from django.contrib.auth.models import User from django.contrib.messages.storage.fallback import FallbackStorage from django.core.exceptions import PermissionDenied + from plinth import module_loader from plinth.modules.users import views