Merge branch 'master' into task/3379/text_style_activation

This commit is contained in:
M.Ravi 2017-06-19 12:37:09 +05:30
commit 0a6275bcef
2 changed files with 9 additions and 1 deletions

View file

@ -4,7 +4,7 @@
{% block content %} {% block content %}
<div class="auth-container"> <div class="auth-container">
<div class="auth-bg"></div> <div class="auth-bg"></div>
<div class="container"> <div class="auth-center">
<div class="auth-title"> <div class="auth-title">
<h2>{% trans "Your VM hosted in Switzerland"%}</h2> <h2>{% trans "Your VM hosted in Switzerland"%}</h2>
</div> </div>

View file

@ -755,6 +755,12 @@ class VirtualMachineView(LoginRequiredMixin, View):
try: try:
vm = manager.get_vm(vm_id) vm = manager.get_vm(vm_id)
return vm return vm
except WrongIdError:
messages.error(self.request,
_('We could not find the requested VM. Please \
contact Data Center Light Support.')
)
return None
except ConnectionRefusedError: except ConnectionRefusedError:
messages.error(self.request, messages.error(self.request,
'We could not load your VM due to a backend connection \ 'We could not load your VM due to a backend connection \
@ -771,6 +777,8 @@ class VirtualMachineView(LoginRequiredMixin, View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
vm = self.get_object() vm = self.get_object()
if vm is None:
return redirect(reverse('hosting:virtual_machines'))
try: try:
serializer = VirtualMachineSerializer(vm) serializer = VirtualMachineSerializer(vm)
context = { context = {