From d33e60c74a8381e79bfcfc4d2a04b065b2ab7469 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 10 Feb 2015 14:38:03 +0530 Subject: [PATCH] upgrades: Minor styling fixes - Remove emacs mode line as emacs automatically detect Python files based on the #! line. - End comments with a '.'. - Use single quotes instead of double quotes for string for consistensy. - Update message to say that it take more than a minute to finish upgrades. Some times it takes a lot more than that. --- actions/upgrades | 1 - plinth/modules/upgrades/templates/upgrades.html | 2 +- plinth/modules/upgrades/upgrades.py | 17 ++++++++--------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/actions/upgrades b/actions/upgrades index 1e5c42d5f..8cd035ca8 100755 --- a/actions/upgrades +++ b/actions/upgrades @@ -1,5 +1,4 @@ #!/usr/bin/python3 -# -*- mode: python -*- # # This file is part of Plinth. # diff --git a/plinth/modules/upgrades/templates/upgrades.html b/plinth/modules/upgrades/templates/upgrades.html index 45f904c46..9e05c9006 100644 --- a/plinth/modules/upgrades/templates/upgrades.html +++ b/plinth/modules/upgrades/templates/upgrades.html @@ -23,7 +23,7 @@

{{ title }}

This will run unattended-upgrades, which will attempt to upgrade your system -with the latest Debian packages. It may take a minute to complete.

+with the latest Debian packages. It may take a few minutes to complete.

{% csrf_token %} diff --git a/plinth/modules/upgrades/upgrades.py b/plinth/modules/upgrades/upgrades.py index 90d11009d..a3652d9a4 100644 --- a/plinth/modules/upgrades/upgrades.py +++ b/plinth/modules/upgrades/upgrades.py @@ -39,16 +39,15 @@ subsubmenu = [{'url': reverse_lazy('upgrades:index'), def init(): - """Initialize the module""" + """Initialize the module.""" menu = cfg.main_menu.get('system:index') - menu.add_urlname("Upgrades", "glyphicon-refresh", - "upgrades:index", 21) + menu.add_urlname(_('Upgrades'), 'glyphicon-refresh', 'upgrades:index', 21) @login_required @package.required('unattended-upgrades') def index(request): - """Serve the index page""" + """Serve the index page.""" return TemplateResponse(request, 'upgrades.html', {'title': _('Package Upgrades'), 'subsubmenu': subsubmenu}) @@ -58,7 +57,7 @@ def index(request): @require_POST @package.required('unattended-upgrades') def run(request): - """Run upgrades and show the output page""" + """Run upgrades and show the output page.""" output = '' error = '' try: @@ -76,7 +75,7 @@ def run(request): class ConfigureForm(forms.Form): - """Configuration form""" + """Configuration form to enable/disable automatic upgrades.""" auto_upgrades_enabled = forms.BooleanField( label=_('Enable automatic upgrades'), required=False, help_text=_('When enabled, the unattended-upgrades program will be \ @@ -87,7 +86,7 @@ available.')) @login_required @package.required('unattended-upgrades') def configure(request): - """Serve the configuration form""" + """Serve the configuration form.""" status = get_status() form = None @@ -108,13 +107,13 @@ def configure(request): def get_status(): - """Return the current status""" + """Return the current status.""" output = actions.run('upgrades', ['check-auto']) return {'auto_upgrades_enabled': 'True' in output.split()} def _apply_changes(request, old_status, new_status): - """Apply the form changes""" + """Apply the form changes.""" if old_status['auto_upgrades_enabled'] \ == new_status['auto_upgrades_enabled']: messages.info(request, _('Setting unchanged'))