catching WrongIdError

This commit is contained in:
Arvind Tiwari 2017-09-15 18:15:06 +05:30
parent 9c0cefd419
commit d49e90bd20

View file

@ -972,10 +972,13 @@ class VirtualMachineView(LoginRequiredMixin, View):
for t in range(15): for t in range(15):
try: try:
manager.get_vm(self.kwargs.get('pk')) manager.get_vm(self.kwargs.get('pk'))
except BaseException: except WrongIdError:
response['status'] = True response['status'] = True
response['redirect'] = self.get_success_url() response['redirect'] = self.get_success_url()
response['text'] = ugettext('Terminated') response['text'] = ugettext('Terminated')
self.send_mail()
break
except BaseException:
break break
else: else:
sleep(2) sleep(2)