From d49e90bd209868b710f6f4d61a45c146482cc5ff Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Fri, 15 Sep 2017 18:15:06 +0530 Subject: [PATCH] catching WrongIdError --- hosting/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hosting/views.py b/hosting/views.py index 201f590a..acd7e67b 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -972,10 +972,13 @@ class VirtualMachineView(LoginRequiredMixin, View): for t in range(15): try: manager.get_vm(self.kwargs.get('pk')) - except BaseException: + except WrongIdError: response['status'] = True response['redirect'] = self.get_success_url() response['text'] = ugettext('Terminated') + self.send_mail() + break + except BaseException: break else: sleep(2)