yapf and isort fixes

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2018-06-13 17:47:11 +05:30
parent b6987b8f3d
commit dfb4ad3260
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
5 changed files with 37 additions and 40 deletions

View File

@ -20,16 +20,13 @@ FreedomBox app to configure Cockpit.
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from plinth.utils import format_lazy
from plinth import actions
from plinth import action_utils
from plinth import cfg
from plinth import frontpage
from plinth import action_utils, actions, cfg, frontpage
from plinth import service as service_module
from plinth.menu import main_menu
from plinth.modules import names
from plinth.signals import domain_added, domain_removed, domainname_change
from plinth.utils import format_lazy
version = 1
@ -53,8 +50,8 @@ description = [
'/_cockpit/</a> path on the web server. It can be accessed by '
'<a href="{users_url}">any user</a> with a {box_name} login. '
'Sensitive information and system altering abilities are limited to '
'users belonging to admin group.'),
box_name=_(cfg.box_name), users_url=reverse_lazy('users:index')),
'users belonging to admin group.'), box_name=_(cfg.box_name),
users_url=reverse_lazy('users:index')),
_('Currently only limited functionality is available.'),
]
@ -70,10 +67,10 @@ def init():
global service
setup_helper = globals()['setup_helper']
if setup_helper.get_state() != 'needs-setup':
service = service_module.Service(
managed_services[0], name, ports=['http', 'https'],
is_external=True,
is_enabled=is_enabled, enable=enable, disable=disable)
service = service_module.Service(managed_services[0], name, ports=[
'http', 'https'
], is_external=True, is_enabled=is_enabled, enable=enable,
disable=disable)
if is_enabled():
add_shortcut()
@ -86,16 +83,17 @@ def init():
def setup(helper, old_version=None):
"""Install and configure the module."""
helper.install(managed_packages)
domains = [domain
for domains_of_a_type in names.domains.values()
for domain in domains_of_a_type]
domains = [
domain for domains_of_a_type in names.domains.values()
for domain in domains_of_a_type
]
helper.call('post', actions.superuser_run, 'cockpit', ['setup'] + domains)
global service
if service is None:
service = service_module.Service(
managed_services[0], name, ports=['http', 'https'],
is_external=True,
is_enabled=is_enabled, enable=enable, disable=disable)
service = service_module.Service(managed_services[0], name, ports=[
'http', 'https'
], is_external=True, is_enabled=is_enabled, enable=enable,
disable=disable)
helper.call('post', service.notify_enabled, None, True)
helper.call('post', add_shortcut)
@ -104,14 +102,13 @@ def add_shortcut():
"""Add a shortcut the frontpage."""
frontpage.add_shortcut('cockpit', name,
short_description=short_description,
url='/_cockpit/',
login_required=True)
url='/_cockpit/', login_required=True)
def is_enabled():
"""Return whether the module is enabled."""
return (action_utils.webserver_is_enabled('cockpit-freedombox') and
action_utils.service_is_running('cockpit.socket'))
return (action_utils.webserver_is_enabled('cockpit-freedombox')
and action_utils.service_is_running('cockpit.socket'))
def enable():

View File

@ -24,8 +24,8 @@ import socket
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from plinth import service as service_module
from plinth import action_utils, actions, cfg, frontpage
from plinth import service as service_module
from plinth.menu import main_menu
from plinth.signals import (domainname_change, post_hostname_change,
pre_hostname_change)
@ -51,10 +51,9 @@ description = [
'web client</a> or any other <a href=\'https://xmpp.org/'
'software/clients\' target=\'_blank\'>XMPP client</a>. '
'When enabled, ejabberd can be accessed by any <a href="{users_url}">'
'user with a {box_name} login</a>.'),
box_name=_(cfg.box_name), users_url=reverse_lazy('users:index'),
jsxc_url=reverse_lazy('jsxc:index')
)
'user with a {box_name} login</a>.'), box_name=_(cfg.box_name),
users_url=reverse_lazy('users:index'),
jsxc_url=reverse_lazy('jsxc:index'))
]
clients = clients
@ -77,10 +76,11 @@ def init():
global service
setup_helper = globals()['setup_helper']
if setup_helper.get_state() != 'needs-setup':
service = service_module.Service('ejabberd', name, ports=[
'xmpp-client', 'xmpp-server', 'xmpp-bosh'
], is_external=True, is_enabled=is_enabled, enable=enable,
disable=disable)
service = service_module.Service(
'ejabberd', name,
ports=['xmpp-client', 'xmpp-server',
'xmpp-bosh'], is_external=True, is_enabled=is_enabled,
enable=enable, disable=disable)
if is_enabled():
add_shortcut()
pre_hostname_change.connect(on_pre_hostname_change)
@ -99,10 +99,11 @@ def setup(helper, old_version=None):
helper.call('post', actions.superuser_run, 'ejabberd', ['setup'])
global service
if service is None:
service = service_module.Service('ejabberd', name, ports=[
'xmpp-client', 'xmpp-server', 'xmpp-bosh'
], is_external=True, is_enabled=is_enabled, enable=enable,
disable=disable)
service = service_module.Service(
'ejabberd', name,
ports=['xmpp-client', 'xmpp-server',
'xmpp-bosh'], is_external=True, is_enabled=is_enabled,
enable=enable, disable=disable)
helper.call('post', service.notify_enabled, None, True)
helper.call('post', add_shortcut)

View File

@ -21,8 +21,8 @@ FreedomBox app to configure ikiwiki.
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from plinth import service as service_module
from plinth import action_utils, actions, cfg, frontpage
from plinth import service as service_module
from plinth.menu import main_menu
from plinth.modules.users import register_group
from plinth.utils import format_lazy
@ -54,7 +54,7 @@ description = [
'group can <i>edit</i> existing ones. In the <a href="{users_url}">'
'User Configuration</a> you can change these '
'permissions or add new users.'), box_name=_(cfg.box_name),
users_url = reverse_lazy('users:index'))
users_url=reverse_lazy('users:index'))
]
clients = clients

View File

@ -21,8 +21,7 @@ from django.utils.translation import ugettext_lazy as _
from plinth.clients import validate
clients = validate([{
'name':
_('JSXC'),
'name': _('JSXC'),
'platforms': [{
'type': 'web',
'url': reverse_lazy('jsxc:jsxc')

View File

@ -21,8 +21,8 @@ FreedomBox app to configure Tiny Tiny RSS.
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from plinth import service as service_module
from plinth import action_utils, actions, cfg, frontpage
from plinth import service as service_module
from plinth.menu import main_menu
from plinth.modules.users import register_group
from plinth.utils import format_lazy