From 0eb2db3f9af83d459813f4b3249ef7291d8357f0 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 28 Aug 2019 15:26:31 -0700 Subject: [PATCH] backups: Use higher level method in views instead of store methods Make store an internal implementation detail of the repository class and achieve better abstraction. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/backups/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plinth/modules/backups/views.py b/plinth/modules/backups/views.py index 6f75bb5f4..3cfa584d8 100644 --- a/plinth/modules/backups/views.py +++ b/plinth/modules/backups/views.py @@ -39,7 +39,7 @@ from plinth.errors import PlinthError from plinth.modules import backups, storage from . import (SESSION_PATH_VARIABLE, api, forms, get_known_hosts_path, - is_ssh_hostkey_verified, split_path, store) + is_ssh_hostkey_verified, split_path) from .decorators import delete_tmp_backup_file from .errors import BorgRepositoryDoesNotExistError from .repository import (BorgRepository, SshBorgRepository, create_repository, @@ -404,9 +404,9 @@ class VerifySshHostkeyView(SuccessMessageMixin, FormView): messages.error(self.request, message) messages.error(self.request, _('Repository removed.')) - # Delete the repository so that the user can have another go at + # Remove the repository so that the user can have another go at # creating it. - store.delete(uuid) + create_repository(uuid).remove() return redirect(reverse_lazy('backups:add-remote-repository')) @@ -495,7 +495,7 @@ def umount_repository(request, uuid): def mount_repository(request, uuid): """View to mount a remote SSH repository.""" # Do not mount unverified ssh repositories. Prompt for verification. - if not store.get(uuid).get('verified'): + if not create_repository(uuid).is_usable(): return redirect('backups:verify-ssh-hostkey', uuid=uuid) repository = SshBorgRepository(uuid=uuid)