diff --git a/plinth/modules/backups/views.py b/plinth/modules/backups/views.py index be58772e1..91fda6fdd 100644 --- a/plinth/modules/backups/views.py +++ b/plinth/modules/backups/views.py @@ -157,7 +157,8 @@ class UploadArchiveView(SuccessMessageMixin, FormView): # - For restoring it's highly advisable to have at least as much # free disk space as the file size. context['max_filesize'] = storage.format_bytes( - disk_info["free_bytes"] / 2) + disk_info['free_bytes'] / 2) + return context def form_valid(self, form): @@ -242,12 +243,13 @@ class RestoreArchiveView(BaseRestoreView): class DownloadArchiveView(View): """View to export and download an archive as stream.""" + def get(self, request, uuid, name): repository = get_repository(uuid) filename = "%s.tar.gz" % name - response = StreamingHttpResponse(repository.get_zipstream(name), - content_type="application/x-gzip") + response = StreamingHttpResponse( + repository.get_zipstream(name), content_type='application/x-gzip') response['Content-Disposition'] = 'attachment; filename="%s"' % \ filename return response @@ -293,8 +295,9 @@ class RemoveRepositoryView(SuccessMessageMixin, TemplateView): """Delete the archive.""" repository = SshBorgRepository(uuid, automount=False) repository.remove_repository() - messages.success(request, _('Repository removed. The remote backup ' - 'itself was not deleted.')) + messages.success( + request, + _('Repository removed. The remote backup itself was not deleted.')) return redirect('backups:index') diff --git a/plinth/modules/storage/__init__.py b/plinth/modules/storage/__init__.py index 3a4c0fc54..7f1d90463 100644 --- a/plinth/modules/storage/__init__.py +++ b/plinth/modules/storage/__init__.py @@ -153,9 +153,9 @@ def get_disk_info(mount_point): free_bytes = list_root[0]['free'] free_gib = free_bytes / (1024**3) return { - "percent_used": percent_used, - "free_bytes": free_bytes, - "free_gib": free_gib + 'percent_used': percent_used, + 'free_bytes': free_bytes, + 'free_gib': free_gib } diff --git a/plinth/modules/storage/views.py b/plinth/modules/storage/views.py index 78f3a5b5e..5afd5b922 100644 --- a/plinth/modules/storage/views.py +++ b/plinth/modules/storage/views.py @@ -105,12 +105,12 @@ def warn_about_low_disk_space(request): # Translators: xgettext:no-python-format _('Warning: Low space on system partition ({percent_used}% used, ' '{free_space} free).'), - percent_used=root_info["percent_used"], - free_space=storage.format_bytes(root_info["free_bytes"])) + percent_used=root_info['percent_used'], + free_space=storage.format_bytes(root_info['free_bytes'])) - if root_info["percent_used"] > 90 or root_info["free_gib"] < 1: + if root_info['percent_used'] > 90 or root_info['free_gib'] < 1: messages.error(request, message) - elif root_info["percent_used"] > 75 or root_info["free_gib"] < 2: + elif root_info['percent_used'] > 75 or root_info['free_gib'] < 2: messages.warning(request, message)