diff --git a/accounts/views.py b/accounts/views.py index 61a26ef..d109d31 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1,6 +1,6 @@ from django.shortcuts import render from django.http import HttpResponseRedirect -from django.core.urlresolvers import reverse +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.decorators import login_required from accounts.models import * diff --git a/computes/views.py b/computes/views.py index dd84592..90e6569 100644 --- a/computes/views.py +++ b/computes/views.py @@ -1,7 +1,7 @@ import json from django.utils import timezone from django.http import HttpResponse, HttpResponseRedirect -from django.core.urlresolvers import reverse +from django.urls import reverse from django.shortcuts import render, get_object_or_404 from django.contrib.auth.decorators import login_required from computes.models import Compute diff --git a/console/novncd b/console/novncd index e49fee9..0f205a0 100755 --- a/console/novncd +++ b/console/novncd @@ -25,8 +25,8 @@ import socket from webvirtcloud.settings import WS_PORT, WS_HOST, WS_CERT from vrtManager.connection import CONN_SSH, CONN_SOCKET from tunnel import Tunnel - from optparse import OptionParser + parser = OptionParser() parser.add_option("-v", @@ -66,7 +66,6 @@ parser.add_option("-c", (options, args) = parser.parse_args() - FORMAT = "%(asctime)s - %(name)s - %(levelname)s : %(message)s" if options.debug: logging.basicConfig(level=logging.DEBUG, format=FORMAT) @@ -88,8 +87,7 @@ except ImportError: try: from novnc.wsproxy import WebSocketProxy except ImportError: - print('Unable to import a websockify implementation, ' + - 'please install one') + print('Unable to import a websockify implementation,\n please install one') sys.exit(1) else: USE_HANDLER = False @@ -220,7 +218,6 @@ if USE_HANDLER: socket_factory = self.server.socket self._new_client(daemon, socket_factory) - else: class NovaWebSocketProxy(WebSocketProxy, CompatibilityMixIn): diff --git a/create/views.py b/create/views.py index 672bb06..c66484f 100644 --- a/create/views.py +++ b/create/views.py @@ -1,7 +1,7 @@ from django.shortcuts import render, get_object_or_404 from django.http import HttpResponseRedirect from django.utils.translation import ugettext_lazy as _ -from django.core.urlresolvers import reverse +from django.urls import reverse from django.contrib.auth.decorators import login_required from computes.models import Compute from create.models import Flavor diff --git a/instances/views.py b/instances/views.py index 7c4753c..20d4616 100644 --- a/instances/views.py +++ b/instances/views.py @@ -8,7 +8,7 @@ import string import random from bisect import insort from django.http import HttpResponse, HttpResponseRedirect -from django.core.urlresolvers import reverse +from django.urls import reverse from django.shortcuts import render, get_object_or_404 from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.decorators import login_required diff --git a/interfaces/views.py b/interfaces/views.py index 6ac9dd6..13b65e5 100644 --- a/interfaces/views.py +++ b/interfaces/views.py @@ -1,6 +1,6 @@ from django.shortcuts import render, get_object_or_404 from django.http import HttpResponseRedirect -from django.core.urlresolvers import reverse +from django.urls import reverse from django.contrib.auth.decorators import login_required from computes.models import Compute from interfaces.forms import AddInterface diff --git a/logs/views.py b/logs/views.py index 6b19f97..a276226 100644 --- a/logs/views.py +++ b/logs/views.py @@ -1,6 +1,6 @@ from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect -from django.core.urlresolvers import reverse +from django.urls import reverse from django.contrib.auth.decorators import login_required from instances.models import Instance from logs.models import Logs diff --git a/networks/views.py b/networks/views.py index 15f10bc..acde835 100644 --- a/networks/views.py +++ b/networks/views.py @@ -1,7 +1,7 @@ from django.shortcuts import render, get_object_or_404 from django.http import HttpResponseRedirect from django.utils.translation import ugettext_lazy as _ -from django.core.urlresolvers import reverse +from django.urls import reverse from django.contrib.auth.decorators import login_required from computes.models import Compute from networks.forms import AddNetPool @@ -44,7 +44,7 @@ def networks(request, compute_id): msg = _("Network pool name already in use") error_messages.append(msg) if data['forward'] == 'bridge' and data['bridge_name'] == '': - error_messages.append('Please enter bridge name') + error_messages.append(_('Please enter bridge name')) if data['subnet']: ipv4 = True gateway4, netmask4, dhcp4 = network_size(data['subnet'], data['dhcp4']) @@ -52,7 +52,7 @@ def networks(request, compute_id): ipv6 = True gateway6, prefix6, dhcp6 = network_size(data['subnet6'], data['dhcp6']) if prefix6 != '64': - error_messages.append('For libvirt, the IPv6 network prefix must be /64') + error_messages.append(_('For libvirt, the IPv6 network prefix must be /64')) if not error_messages: conn.create_network(data['name'], data['forward'], @@ -113,7 +113,7 @@ def network(request, compute_id, pool): ipv6_network = ip_network ipv6_fixed_address = conn.get_dhcp_host_addr(family) else: - raise Exception("Unknown Network Family") + raise Exception(_("Unknown Network Family")) xml = conn._XMLDesc(0) except libvirtError as lib_err: @@ -163,7 +163,7 @@ def network(request, compute_id, pool): try: ret_val = conn.modify_fixed_address(name, address, mac_duid, family) - messages.success(request, "{} Fixed Address Operation Completed.".format(family.upper())) + messages.success(request, _("{} Fixed Address Operation Completed.").format(family.upper())) return HttpResponseRedirect(request.get_full_path()) except libvirtError as lib_err: error_messages.append(lib_err.message) @@ -173,7 +173,7 @@ def network(request, compute_id, pool): ip = request.POST.get('address', '') family = request.POST.get('family', 'ipv4') conn.delete_fixed_address(ip, family) - messages.success(request, "{} Fixed Address is Deleted.".format(family.upper())) + messages.success(request, _("{} Fixed Address is Deleted.").format(family.upper())) return HttpResponseRedirect(request.get_full_path()) if 'modify_dhcp_range' in request.POST: range_start = request.POST.get('range_start', '') @@ -181,7 +181,7 @@ def network(request, compute_id, pool): family = request.POST.get('family', 'ipv4') try: conn.modify_dhcp_range(range_start, range_end, family) - messages.success(request, "{} DHCP Range is Changed.".format(family.upper())) + messages.success(request, _("{} DHCP Range is Changed.").format(family.upper())) return HttpResponseRedirect(request.get_full_path()) except libvirtError as lib_err: error_messages.append(lib_err.message) @@ -204,10 +204,10 @@ def network(request, compute_id, pool): try: conn.set_qos(qos_dir, average, peak, burst) if conn.is_active(): - messages.success(request, "{} Qos is set. Network XML is changed.".format(qos_dir.capitalize()) + - "Stop and start network to activate new config") + messages.success(request, _("{} Qos is set. Network XML is changed.").format(qos_dir.capitalize()) + + _("Stop and start network to activate new config")) else: - messages.success(request, "{} Qos is set".format(qos_dir.capitalize())) + messages.success(request, _("{} Qos is set").format(qos_dir.capitalize())) except libvirtError as le: messages.error(request, le.message) return HttpResponseRedirect(request.get_full_path()) @@ -216,10 +216,10 @@ def network(request, compute_id, pool): conn.unset_qos(qos_dir) if conn.is_active(): - messages.success(request, "{} Qos is deleted. Network XML is changed. ".format(qos_dir.capitalize()) + - "Stop and start network to activate new config.") + messages.success(request, _("{} Qos is deleted. Network XML is changed. ").format(qos_dir.capitalize()) + + _("Stop and start network to activate new config.")) else: - messages.success(request, "{} Qos is deleted".format(qos_dir.capitalize())) + messages.success(request, _("{} Qos is deleted").format(qos_dir.capitalize())) return HttpResponseRedirect(request.get_full_path()) conn.close() diff --git a/nwfilters/views.py b/nwfilters/views.py index 6f2529b..c8e35e8 100644 --- a/nwfilters/views.py +++ b/nwfilters/views.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals from django.http import HttpResponseRedirect from django.shortcuts import render, get_object_or_404 from django.utils.translation import ugettext_lazy as _ -from django.core.urlresolvers import reverse +from django.urls import reverse from django.contrib.auth.decorators import login_required from computes.models import Compute from vrtManager import util diff --git a/secrets/views.py b/secrets/views.py index efc0a09..a21ffd8 100644 --- a/secrets/views.py +++ b/secrets/views.py @@ -1,6 +1,6 @@ from django.shortcuts import render, get_object_or_404 from django.http import HttpResponseRedirect -from django.core.urlresolvers import reverse +from django.urls import reverse from django.contrib.auth.decorators import login_required from computes.models import Compute from secrets.forms import AddSecret