mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
Add flake8 to gitlib-ci - closes #58
And fix the rest of the flake8 errors. Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
f81b1751ce
commit
5439084c84
@ -21,6 +21,7 @@ run-unit-tests:
|
|||||||
- echo "tester:password" | chpasswd
|
- echo "tester:password" | chpasswd
|
||||||
- cp -r . /home/tester/plinth
|
- cp -r . /home/tester/plinth
|
||||||
- chown -R tester:tester /home/tester/plinth
|
- chown -R tester:tester /home/tester/plinth
|
||||||
|
- su -c "cd ~/plinth; python3 -m flake8 plinth" tester
|
||||||
- su -c "cd ~/plinth; py.test-3 --cov=plinth --cov-report=html --cov-report=term" tester
|
- su -c "cd ~/plinth; py.test-3 --cov=plinth --cov-report=html --cov-report=term" tester
|
||||||
- cp -r /home/tester/plinth/htmlcov test-coverage-report
|
- cp -r /home/tester/plinth/htmlcov test-coverage-report
|
||||||
|
|
||||||
|
|||||||
@ -26,5 +26,4 @@ class AppConfig(apps.AppConfig):
|
|||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
# Signals must be loaded for axes to get the login_failed signals
|
# Signals must be loaded for axes to get the login_failed signals
|
||||||
# flake8: noqa
|
from axes import signals # noqa pylint: disable=unused-import isort:skip
|
||||||
from axes import signals # isort:skip pylint: disable=unused-import
|
|
||||||
|
|||||||
@ -69,8 +69,8 @@ class Uwsgi(app.LeaderComponent):
|
|||||||
component_id should be a unique ID across all components of an app and
|
component_id should be a unique ID across all components of an app and
|
||||||
across all components.
|
across all components.
|
||||||
|
|
||||||
uwsgi_name is the primary part of the configuration file path which must
|
uwsgi_name is the primary part of the configuration file path
|
||||||
be enabled/disabled by this component.
|
which must be enabled/disabled by this component.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super().__init__(component_id)
|
super().__init__(component_id)
|
||||||
|
|||||||
@ -28,7 +28,7 @@ from plinth.modules.firewall.components import Firewall
|
|||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
from plinth.views import AppView
|
from plinth.views import AppView
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
# pylint: disable=C0103
|
# pylint: disable=C0103
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from plinth.daemon import Daemon
|
|||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ from plinth.modules.firewall.components import Firewall
|
|||||||
from plinth.signals import domain_added, domain_removed, domainname_change
|
from plinth.signals import domain_added, domain_removed, domainname_change
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -113,7 +113,9 @@ def get_home_page():
|
|||||||
|
|
||||||
|
|
||||||
def change_home_page(shortcut_id):
|
def change_home_page(shortcut_id):
|
||||||
"""Change the FreedomBox's default redirect to URL of the shortcut specified."""
|
"""Change the FreedomBox's default redirect to URL of the shortcut
|
||||||
|
specified.
|
||||||
|
"""
|
||||||
if shortcut_id == 'plinth':
|
if shortcut_id == 'plinth':
|
||||||
url = '/plinth/'
|
url = '/plinth/'
|
||||||
elif shortcut_id == 'apache-default':
|
elif shortcut_id == 'apache-default':
|
||||||
|
|||||||
@ -62,11 +62,12 @@ class ConfigurationForm(forms.Form):
|
|||||||
hostname = forms.CharField(
|
hostname = forms.CharField(
|
||||||
label=ugettext_lazy('Hostname'), help_text=format_lazy(
|
label=ugettext_lazy('Hostname'), help_text=format_lazy(
|
||||||
ugettext_lazy(
|
ugettext_lazy(
|
||||||
'Hostname is the local name by which other devices on the local '
|
'Hostname is the local name by which other devices on the '
|
||||||
'network can reach your {box_name}. It must start and end with '
|
'local network can reach your {box_name}. It must start and '
|
||||||
'an alphabet or a digit and have as interior characters only '
|
'end with an alphabet or a digit and have as interior '
|
||||||
'alphabets, digits and hyphens. Total length must be 63 '
|
'characters only alphabets, digits and hyphens. Total '
|
||||||
'characters or less.'), box_name=ugettext_lazy(cfg.box_name)),
|
'length must be 63 characters or less.'),
|
||||||
|
box_name=ugettext_lazy(cfg.box_name)),
|
||||||
validators=[
|
validators=[
|
||||||
validators.RegexValidator(HOSTNAME_REGEX,
|
validators.RegexValidator(HOSTNAME_REGEX,
|
||||||
ugettext_lazy('Invalid hostname'))
|
ugettext_lazy('Invalid hostname'))
|
||||||
@ -76,12 +77,13 @@ class ConfigurationForm(forms.Form):
|
|||||||
label=ugettext_lazy('Domain Name'), help_text=format_lazy(
|
label=ugettext_lazy('Domain Name'), help_text=format_lazy(
|
||||||
ugettext_lazy(
|
ugettext_lazy(
|
||||||
'Domain name is the global name by which other devices on the '
|
'Domain name is the global name by which other devices on the '
|
||||||
'Internet can reach your {box_name}. It must consist of labels '
|
'Internet can reach your {box_name}. It must consist of '
|
||||||
'separated by dots. Each label must start and end with an '
|
'labels separated by dots. Each label must start and end '
|
||||||
'alphabet or a digit and have as interior characters only '
|
'with an alphabet or a digit and have as interior characters '
|
||||||
'alphabets, digits and hyphens. Length of each label must be 63 '
|
'only alphabets, digits and hyphens. Length of each label '
|
||||||
'characters or less. Total length of domain name must be 253 '
|
'must be 63 characters or less. Total length of domain name '
|
||||||
'characters or less.'), box_name=ugettext_lazy(cfg.box_name)),
|
'must be 253 characters or less.'),
|
||||||
|
box_name=ugettext_lazy(cfg.box_name)),
|
||||||
required=False, validators=[
|
required=False, validators=[
|
||||||
validators.RegexValidator(
|
validators.RegexValidator(
|
||||||
r'^[a-zA-Z0-9]([-a-zA-Z0-9.]{,251}[a-zA-Z0-9])?$',
|
r'^[a-zA-Z0-9]([-a-zA-Z0-9.]{,251}[a-zA-Z0-9])?$',
|
||||||
|
|||||||
@ -27,7 +27,7 @@ from plinth.daemon import Daemon
|
|||||||
from plinth.modules.apache.components import Webserver
|
from plinth.modules.apache.components import Webserver
|
||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
clients = clients
|
clients = clients
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ from plinth import app as app_module
|
|||||||
from plinth import menu
|
from plinth import menu
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 2
|
version = 2
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ from plinth.modules.apache.components import Webserver
|
|||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.modules.users import register_group
|
from plinth.modules.users import register_group
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 2
|
version = 2
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ from plinth import action_utils
|
|||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import menu
|
from plinth import menu
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ description = [
|
|||||||
' federate with other diaspora* pods.')
|
' federate with other diaspora* pods.')
|
||||||
]
|
]
|
||||||
|
|
||||||
from .manifest import clients # isort:skip
|
from .manifest import clients # noqa pylint:disable=E402 isort:skip
|
||||||
clients = clients
|
clients = clients
|
||||||
|
|
||||||
app = None
|
app = None
|
||||||
|
|||||||
@ -28,7 +28,7 @@ from plinth.modules.names import SERVICES
|
|||||||
from plinth.signals import domain_added
|
from plinth.signals import domain_added
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ from plinth.signals import (domainname_change, post_hostname_change,
|
|||||||
pre_hostname_change)
|
pre_hostname_change)
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ from django.contrib import messages
|
|||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from plinth import actions
|
from plinth import actions
|
||||||
from plinth.modules import config, ejabberd
|
from plinth.modules import ejabberd
|
||||||
from plinth.views import AppView
|
from plinth.views import AppView
|
||||||
|
|
||||||
from .forms import EjabberdForm
|
from .forms import EjabberdForm
|
||||||
|
|||||||
@ -25,7 +25,7 @@ from plinth import app as app_module
|
|||||||
from plinth import cfg, menu
|
from plinth import cfg, menu
|
||||||
from plinth.utils import Version, format_lazy
|
from plinth.utils import Version, format_lazy
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 2
|
version = 2
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall
|
|||||||
from plinth.modules.i2p.resources import FAVORITES
|
from plinth.modules.i2p.resources import FAVORITES
|
||||||
from plinth.modules.users import register_group
|
from plinth.modules.users import register_group
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -96,8 +96,11 @@ class TunnelEditor():
|
|||||||
:rtype: basestring
|
:rtype: basestring
|
||||||
|
|
||||||
"""
|
"""
|
||||||
calced_prop_path = '/files{filepath}/tunnel.{idx}.{tunnel_prop}'.format(
|
calced_prop_path = \
|
||||||
idx=self.idx, tunnel_prop=tunnel_prop, filepath=self.conf_filename)
|
'/files{filepath}/tunnel.{idx}.{tunnel_prop}'.format(
|
||||||
|
idx=self.idx,
|
||||||
|
tunnel_prop=tunnel_prop,
|
||||||
|
filepath=self.conf_filename)
|
||||||
return calced_prop_path
|
return calced_prop_path
|
||||||
|
|
||||||
def set_tunnel_prop(self, tunnel_prop, value):
|
def set_tunnel_prop(self, tunnel_prop, value):
|
||||||
|
|||||||
@ -104,6 +104,6 @@ class TorrentsView(ServiceBaseView):
|
|||||||
service_path = '/i2p/i2psnark/'
|
service_path = '/i2p/i2psnark/'
|
||||||
service_description = [
|
service_description = [
|
||||||
_('I2P provides an application to download files anonymously in a '
|
_('I2P provides an application to download files anonymously in a '
|
||||||
'peer-to-peer network. Download files by adding torrents or create a '
|
'peer-to-peer network. Download files by adding torrents or '
|
||||||
'new torrent to share a file.'),
|
'create a new torrent to share a file.'),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall
|
|||||||
from plinth.modules.users import register_group
|
from plinth.modules.users import register_group
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall
|
|||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
from plinth.views import AppView
|
from plinth.views import AppView
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ from plinth import app as app_module
|
|||||||
from plinth import frontpage, menu
|
from plinth import frontpage, menu
|
||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ from plinth.signals import (domain_added, domain_removed, domainname_change,
|
|||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from . import components
|
from . import components
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
|||||||
@ -275,7 +275,9 @@ def test_on_certificate_obtained(superuser_run, component):
|
|||||||
|
|
||||||
|
|
||||||
def test_on_certificate_obtained_with_all_domains(superuser_run, component):
|
def test_on_certificate_obtained_with_all_domains(superuser_run, component):
|
||||||
"""Test that certificate obtained event handler works for app with all domains."""
|
"""Test that certificate obtained event handler works for app with
|
||||||
|
all domains.
|
||||||
|
"""
|
||||||
component._domains = '*'
|
component._domains = '*'
|
||||||
component.on_certificate_obtained(['valid.example'],
|
component.on_certificate_obtained(['valid.example'],
|
||||||
'/etc/letsencrypt/live/valid.example/')
|
'/etc/letsencrypt/live/valid.example/')
|
||||||
@ -286,7 +288,9 @@ def test_on_certificate_obtained_with_all_domains(superuser_run, component):
|
|||||||
|
|
||||||
|
|
||||||
def test_on_certificate_obtained_irrelevant(superuser_run, component):
|
def test_on_certificate_obtained_irrelevant(superuser_run, component):
|
||||||
"""Test that certificate obtained event handler works with irrelevant domain."""
|
"""Test that certificate obtained event handler works with
|
||||||
|
irrelevant domain.
|
||||||
|
"""
|
||||||
component.on_certificate_obtained(
|
component.on_certificate_obtained(
|
||||||
['irrelevant.example'], '/etc/letsencrypt/live/irrelevant.example/')
|
['irrelevant.example'], '/etc/letsencrypt/live/irrelevant.example/')
|
||||||
_assert_copy_certificate_called(component, superuser_run, {})
|
_assert_copy_certificate_called(component, superuser_run, {})
|
||||||
@ -313,7 +317,9 @@ def test_on_certificate_renewed(superuser_run, component):
|
|||||||
|
|
||||||
|
|
||||||
def test_on_certificate_renewed_irrelevant(superuser_run, component):
|
def test_on_certificate_renewed_irrelevant(superuser_run, component):
|
||||||
"""Test that certificate renewed event handler works for irrelevant domains."""
|
"""Test that certificate renewed event handler works for
|
||||||
|
irrelevant domains.
|
||||||
|
"""
|
||||||
component.on_certificate_renewed(
|
component.on_certificate_renewed(
|
||||||
['irrelevant.example'], '/etc/letsencrypt/live/irrelevant.example/')
|
['irrelevant.example'], '/etc/letsencrypt/live/irrelevant.example/')
|
||||||
_assert_copy_certificate_called(component, superuser_run, {})
|
_assert_copy_certificate_called(component, superuser_run, {})
|
||||||
@ -340,7 +346,9 @@ def test_on_certificate_revoked(superuser_run, component):
|
|||||||
|
|
||||||
|
|
||||||
def test_on_certificate_revoked_irrelevant(superuser_run, component):
|
def test_on_certificate_revoked_irrelevant(superuser_run, component):
|
||||||
"""Test that certificate revoked event handler works for irrelevant domains."""
|
"""Test that certificate revoked event handler works for
|
||||||
|
irrelevant domains.
|
||||||
|
"""
|
||||||
component.on_certificate_revoked(
|
component.on_certificate_revoked(
|
||||||
['irrelevant.example'], '/etc/letsencrypt/live/irrelevant.example/')
|
['irrelevant.example'], '/etc/letsencrypt/live/irrelevant.example/')
|
||||||
_assert_copy_certificate_called(component, superuser_run, {})
|
_assert_copy_certificate_called(component, superuser_run, {})
|
||||||
@ -367,7 +375,9 @@ def test_on_certificate_deleted(superuser_run, component):
|
|||||||
|
|
||||||
|
|
||||||
def test_on_certificate_deleted_irrelevant(superuser_run, component):
|
def test_on_certificate_deleted_irrelevant(superuser_run, component):
|
||||||
"""Test that certificate deleted event handler works for irrelevant domains."""
|
"""Test that certificate deleted event handler works for
|
||||||
|
irrelevant domains.
|
||||||
|
"""
|
||||||
component.on_certificate_deleted(
|
component.on_certificate_deleted(
|
||||||
['irrelevant.example'], '/etc/letsencrypt/live/irrelevant.example/')
|
['irrelevant.example'], '/etc/letsencrypt/live/irrelevant.example/')
|
||||||
_assert_copy_certificate_called(component, superuser_run, {})
|
_assert_copy_certificate_called(component, superuser_run, {})
|
||||||
|
|||||||
@ -27,7 +27,6 @@ from django.urls import reverse_lazy
|
|||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
from django.views.decorators.http import require_POST
|
from django.views.decorators.http import require_POST
|
||||||
|
|
||||||
from plinth import actions
|
|
||||||
from plinth.errors import ActionError
|
from plinth.errors import ActionError
|
||||||
from plinth.modules import letsencrypt
|
from plinth.modules import letsencrypt
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ from plinth.modules.apache.components import Webserver
|
|||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.modules.letsencrypt.components import LetsEncrypt
|
from plinth.modules.letsencrypt.components import LetsEncrypt
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 5
|
version = 5
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ from plinth.daemon import Daemon
|
|||||||
from plinth.modules.apache.components import Webserver
|
from plinth.modules.apache.components import Webserver
|
||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 6
|
version = 6
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from plinth.daemon import Daemon
|
|||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 2
|
version = 2
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall
|
|||||||
from plinth.modules.users import register_group
|
from plinth.modules.users import register_group
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import menu
|
from plinth import menu
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ from plinth.daemon import Daemon
|
|||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.views import AppView
|
from plinth.views import AppView
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ from plinth import cfg, menu
|
|||||||
from plinth.signals import domain_added, domain_removed
|
from plinth.signals import domain_added, domain_removed
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
SERVICES = (
|
SERVICES = (
|
||||||
('http', _('HTTP'), 80),
|
('http', _('HTTP'), 80),
|
||||||
|
|||||||
@ -28,7 +28,7 @@ from plinth.daemon import Daemon
|
|||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ from plinth import cfg, menu
|
|||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from . import utils
|
from . import utils
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,7 @@ _tests = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_convert_service_to_string():
|
def test_convert_service_to_string():
|
||||||
""" Test deconstructing parameter dictionaries into strings """
|
""" Test deconstructing parameter dictionaries into strings """
|
||||||
for test in _tests:
|
for test in _tests:
|
||||||
|
|||||||
@ -20,7 +20,7 @@ FreedomBox app for power controls.
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall
|
|||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
from plinth.views import AppView
|
from plinth.views import AppView
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall
|
|||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
from plinth.views import AppView
|
from plinth.views import AppView
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ from plinth.modules.apache.components import Uwsgi, Webserver
|
|||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 2
|
version = 2
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,8 @@ clients = validate([{
|
|||||||
'usage':
|
'usage':
|
||||||
_('In Evolution add a new calendar and address book '
|
_('In Evolution add a new calendar and address book '
|
||||||
'respectively with WebDAV. Enter the URL of the Radicale '
|
'respectively with WebDAV. Enter the URL of the Radicale '
|
||||||
'server (e.g. https://<your.freedombox.address>) and your user name. '
|
'server (e.g. https://<your.freedombox.address>) and your '
|
||||||
|
'user name. '
|
||||||
'Clicking on the search button will list the existing '
|
'Clicking on the search button will list the existing '
|
||||||
'calendars and address books.'),
|
'calendars and address books.'),
|
||||||
'platforms': [{
|
'platforms': [{
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from plinth.modules.apache.components import Webserver
|
|||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.views import AppView
|
from plinth.views import AppView
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 2
|
version = 2
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ from plinth import frontpage, menu
|
|||||||
from plinth.modules.apache.components import Webserver
|
from plinth.modules.apache.components import Webserver
|
||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from plinth.modules.apache.components import Uwsgi, Webserver
|
|||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.modules.users import register_group
|
from plinth.modules.users import register_group
|
||||||
|
|
||||||
from .manifest import PUBLIC_ACCESS_SETTING_FILE, backup, clients
|
from .manifest import PUBLIC_ACCESS_SETTING_FILE, backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
clients = clients
|
clients = clients
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ from plinth import actions
|
|||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import menu
|
from plinth import menu
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 6
|
version = 6
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,6 @@ class SecurityForm(forms.Form):
|
|||||||
'without further authorization.'))
|
'without further authorization.'))
|
||||||
fail2ban_enabled = forms.BooleanField(
|
fail2ban_enabled = forms.BooleanField(
|
||||||
label=_('Fail2Ban (recommended)'), required=False,
|
label=_('Fail2Ban (recommended)'), required=False,
|
||||||
help_text=_('When this option is enabled, Fail2Ban will limit brute force '
|
help_text=_('When this option is enabled, Fail2Ban will limit '
|
||||||
'break-in attempts to the SSH server and other enabled '
|
'brute force break-in attempts to the SSH server and '
|
||||||
'password protected internet-services.'))
|
'other enabled password protected internet-services.'))
|
||||||
|
|||||||
@ -28,7 +28,7 @@ from plinth.daemon import Daemon
|
|||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ from plinth import app as app_module
|
|||||||
from plinth import cfg, menu
|
from plinth import cfg, menu
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -75,5 +75,5 @@ class AddShareForm(forms.Form):
|
|||||||
groups = self.cleaned_data.get('groups')
|
groups = self.cleaned_data.get('groups')
|
||||||
if not is_public and not groups:
|
if not is_public and not groups:
|
||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
_('Shares should be either public or shared with at least one group'
|
_('Shares should be either public or shared with at '
|
||||||
))
|
'least one group'))
|
||||||
|
|||||||
@ -28,7 +28,7 @@ from plinth import app as app_module
|
|||||||
from plinth import menu
|
from plinth import menu
|
||||||
from plinth.modules import storage
|
from plinth.modules import storage
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 4
|
version = 4
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,8 @@ from . import views
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^sys/snapshot/$', views.index, name='index'),
|
url(r'^sys/snapshot/$', views.index, name='index'),
|
||||||
url(r'^sys/snapshot/manage/$', views.manage, name='manage'),
|
url(r'^sys/snapshot/manage/$', views.manage, name='manage'),
|
||||||
url(r'^sys/snapshot/selected/delete$', views.delete_selected, name='delete-selected'),
|
url(r'^sys/snapshot/selected/delete$', views.delete_selected,
|
||||||
|
name='delete-selected'),
|
||||||
url(r'^sys/snapshot/(?P<number>\d+)/rollback$', views.rollback,
|
url(r'^sys/snapshot/(?P<number>\d+)/rollback$', views.rollback,
|
||||||
name='rollback'),
|
name='rollback'),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -137,7 +137,8 @@ def update_configuration(request, old_status, new_status):
|
|||||||
('free_space', 'FREE_LIMIT={}'),
|
('free_space', 'FREE_LIMIT={}'),
|
||||||
]))
|
]))
|
||||||
|
|
||||||
if old_status['enable_software_snapshots'] != new_status['enable_software_snapshots']:
|
if old_status['enable_software_snapshots'] != new_status[
|
||||||
|
'enable_software_snapshots']:
|
||||||
if new_status['enable_software_snapshots'] == 'yes':
|
if new_status['enable_software_snapshots'] == 'yes':
|
||||||
actions.superuser_run('snapshot', ['disable-apt-snapshot', 'no'])
|
actions.superuser_run('snapshot', ['disable-apt-snapshot', 'no'])
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -27,7 +27,7 @@ from plinth.daemon import Daemon
|
|||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.views import AppView
|
from plinth.views import AppView
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,9 @@
|
|||||||
Forms for the Single Sign On app of FreedomBox.
|
Forms for the Single Sign On app of FreedomBox.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.contrib.auth.forms import AuthenticationForm as DjangoAuthenticationForm
|
from django.contrib.auth.forms import (
|
||||||
|
AuthenticationForm as DjangoAuthenticationForm
|
||||||
|
)
|
||||||
from captcha.fields import CaptchaField
|
from captcha.fields import CaptchaField
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import subprocess
|
|||||||
import psutil
|
import psutil
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from plinth import action_utils, actions
|
from plinth import actions
|
||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import cfg, menu, utils
|
from plinth import cfg, menu, utils
|
||||||
from plinth.daemon import Daemon
|
from plinth.daemon import Daemon
|
||||||
|
|||||||
@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall
|
|||||||
from plinth.modules.users import register_group
|
from plinth.modules.users import register_group
|
||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 2
|
version = 2
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ from plinth.modules.firewall.components import Firewall
|
|||||||
from plinth.utils import format_lazy
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
from .errors import TahoeConfigurationError
|
from .errors import TahoeConfigurationError
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ from plinth.modules.names import SERVICES
|
|||||||
from plinth.signals import domain_added, domain_removed
|
from plinth.signals import domain_added, domain_removed
|
||||||
|
|
||||||
from . import utils
|
from . import utils
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ from plinth.modules.apache.components import Webserver
|
|||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.modules.users import register_group
|
from plinth.modules.users import register_group
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 2
|
version = 2
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ from plinth.modules.firewall.components import Firewall
|
|||||||
from plinth.modules.users import register_group
|
from plinth.modules.users import register_group
|
||||||
from plinth.utils import Version, format_lazy
|
from plinth.utils import Version, format_lazy
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ from plinth import actions
|
|||||||
from plinth import app as app_module
|
from plinth import app as app_module
|
||||||
from plinth import menu
|
from plinth import menu
|
||||||
|
|
||||||
from .manifest import backup
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
|||||||
@ -159,7 +159,8 @@ class UserDelete(ContextMixin, DeleteView):
|
|||||||
messages.success(self.request, message)
|
messages.success(self.request, message)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
actions.superuser_run('users', ['remove-user', self.kwargs['slug']])
|
actions.superuser_run(
|
||||||
|
'users', ['remove-user', self.kwargs['slug']])
|
||||||
except ActionError:
|
except ActionError:
|
||||||
messages.error(self.request,
|
messages.error(self.request,
|
||||||
_('Deleting LDAP user failed.'))
|
_('Deleting LDAP user failed.'))
|
||||||
|
|||||||
@ -32,6 +32,6 @@ backups_ssh_repo_uuid = 'plinth_test_sshfs' # will be mounted to /media/<uuid>
|
|||||||
|
|
||||||
# Import config_local to override the default variables
|
# Import config_local to override the default variables
|
||||||
try:
|
try:
|
||||||
from .config_local import *
|
from .config_local import * # noqa, pylint: disable=unused-import
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user