diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-09-09 03:33:27 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-09-09 03:33:27 +0000 |
commit | dee5c9d3f48b0a092ddf065f360518c2a6015861 (patch) | |
tree | 9e30ca3d0c671141c0d48593620bf2edb174bf21 /openstack_dashboard/dashboards/project | |
parent | 2aa3cc95286424718d8988a9aa51215c13917bd7 (diff) | |
parent | 4e8549ee9a21ea8a2f44c8607b0abaf1a63f66a3 (diff) | |
download | horizon-dee5c9d3f48b0a092ddf065f360518c2a6015861.tar.gz |
Merge "Replace SortedDict with OrderedDict"
Diffstat (limited to 'openstack_dashboard/dashboards/project')
5 files changed, 18 insertions, 16 deletions
diff --git a/openstack_dashboard/dashboards/project/instances/console.py b/openstack_dashboard/dashboards/project/instances/console.py index e592539da..17b92fc0a 100644 --- a/openstack_dashboard/dashboards/project/instances/console.py +++ b/openstack_dashboard/dashboards/project/instances/console.py @@ -11,9 +11,9 @@ # License for the specific language governing permissions and limitations # under the License. +from collections import OrderedDict import logging -from django.utils.datastructures import SortedDict from django.utils.http import urlencode from django.utils.translation import ugettext_lazy as _ import six @@ -26,7 +26,7 @@ from openstack_dashboard import api LOG = logging.getLogger(__name__) -CONSOLES = SortedDict([('VNC', api.nova.server_vnc_console), +CONSOLES = OrderedDict([('VNC', api.nova.server_vnc_console), ('SPICE', api.nova.server_spice_console), ('RDP', api.nova.server_rdp_console), ('SERIAL', api.nova.server_serial_console)]) diff --git a/openstack_dashboard/dashboards/project/instances/tests.py b/openstack_dashboard/dashboards/project/instances/tests.py index 489f496df..9ace9dca4 100644 --- a/openstack_dashboard/dashboards/project/instances/tests.py +++ b/openstack_dashboard/dashboards/project/instances/tests.py @@ -16,6 +16,7 @@ # License for the specific language governing permissions and limitations # under the License. +from collections import OrderedDict import json import logging import sys @@ -27,7 +28,6 @@ from django.core.urlresolvers import reverse from django.forms import widgets from django import http import django.test -from django.utils.datastructures import SortedDict from django.utils import encoding from django.utils.http import urlencode from mox3.mox import IgnoreArg # noqa @@ -133,7 +133,7 @@ class InstanceTests(helpers.TestCase): def test_index_flavor_list_exception(self): servers = self.servers.list() flavors = self.flavors.list() - full_flavors = SortedDict([(f.id, f) for f in flavors]) + full_flavors = OrderedDict([(f.id, f) for f in flavors]) search_opts = {'marker': None, 'paginate': True} api.nova.extension_supported('AdminActions', IsA(http.HttpRequest)) \ @@ -4166,7 +4166,7 @@ class InstanceAjaxTests(helpers.TestCase): instance_id = server.id flavor_id = server.flavor["id"] flavors = self.flavors.list() - full_flavors = SortedDict([(f.id, f) for f in flavors]) + full_flavors = OrderedDict([(f.id, f) for f in flavors]) api.nova.extension_supported('AdminActions', IsA(http.HttpRequest))\ .MultipleTimes().AndReturn(True) @@ -4197,7 +4197,7 @@ class InstanceAjaxTests(helpers.TestCase): instance_id = server.id flavor_id = server.flavor["id"] flavors = self.flavors.list() - full_flavors = SortedDict([(f.id, f) for f in flavors]) + full_flavors = OrderedDict([(f.id, f) for f in flavors]) server.status = 'ERROR' server.fault = {"message": "NoValidHost", @@ -4275,7 +4275,7 @@ class ConsoleManagerTests(helpers.TestCase): def setup_consoles(self): # Need to refresh with mocks or will fail since mox do not detect # the api_call() as mocked. - console.CONSOLES = SortedDict([ + console.CONSOLES = OrderedDict([ ('VNC', api.nova.server_vnc_console), ('SPICE', api.nova.server_spice_console), ('RDP', api.nova.server_rdp_console), diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py index e703b2ba5..992bda9ec 100644 --- a/openstack_dashboard/dashboards/project/instances/views.py +++ b/openstack_dashboard/dashboards/project/instances/views.py @@ -19,13 +19,13 @@ """ Views for managing instances. """ +from collections import OrderedDict import logging from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse_lazy from django import http from django import shortcuts -from django.utils.datastructures import SortedDict from django.utils.translation import ugettext_lazy as _ from django.views import generic @@ -100,9 +100,9 @@ class IndexView(tables.DataTableView): images = [] exceptions.handle(self.request, ignore=True) - full_flavors = SortedDict([(str(flavor.id), flavor) + full_flavors = OrderedDict([(str(flavor.id), flavor) for flavor in flavors]) - image_map = SortedDict([(str(image.id), image) + image_map = OrderedDict([(str(image.id), image) for image in images]) # Loop through instances to get flavor info. @@ -416,7 +416,7 @@ class ResizeView(workflows.WorkflowView): def get_flavors(self, *args, **kwargs): try: flavors = api.nova.flavor_list(self.request) - return SortedDict((str(flavor.id), flavor) for flavor in flavors) + return OrderedDict((str(flavor.id), flavor) for flavor in flavors) except Exception: redirect = reverse("horizon:project:instances:index") exceptions.handle(self.request, diff --git a/openstack_dashboard/dashboards/project/routers/views.py b/openstack_dashboard/dashboards/project/routers/views.py index 591c578f0..4781bfaa9 100644 --- a/openstack_dashboard/dashboards/project/routers/views.py +++ b/openstack_dashboard/dashboards/project/routers/views.py @@ -17,9 +17,10 @@ Views for managing Neutron Routers. """ +from collections import OrderedDict + from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse_lazy -from django.utils.datastructures import SortedDict from django.utils.translation import pgettext_lazy from django.utils.translation import ugettext_lazy as _ @@ -68,8 +69,8 @@ class IndexView(tables.DataTableView): search_opts = {'router:external': True} ext_nets = api.neutron.network_list(self.request, **search_opts) - ext_net_dict = SortedDict((n['id'], n.name_or_id) - for n in ext_nets) + ext_net_dict = OrderedDict((n['id'], n.name_or_id) + for n in ext_nets) except Exception as e: msg = _('Unable to retrieve a list of external networks "%s".') % e exceptions.handle(self.request, msg) diff --git a/openstack_dashboard/dashboards/project/volumes/tabs.py b/openstack_dashboard/dashboards/project/volumes/tabs.py index 907448fc7..acdb41f25 100644 --- a/openstack_dashboard/dashboards/project/volumes/tabs.py +++ b/openstack_dashboard/dashboards/project/volumes/tabs.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.datastructures import SortedDict +from collections import OrderedDict + from django.utils.translation import ugettext_lazy as _ from horizon import exceptions @@ -68,7 +69,7 @@ class VolumeTableMixIn(object): volumes, instances, volume_ids_with_snapshots): - instances = SortedDict([(inst.id, inst) for inst in instances]) + instances = OrderedDict([(inst.id, inst) for inst in instances]) for volume in volumes: if volume_ids_with_snapshots: if volume.id in volume_ids_with_snapshots: |