Replace SortedDict with OrderedDict and fixing Python 3.5 test

Starting with Django 1.9 SortedDict has been removed completely,
and this is currently blocking the gate.

This patch replaces SortedDict with the python native OrderedDict.

Depends-On: Iebca15ae962a1aa0825c6ba6d482206531726696
Change-Id: Ia7955ac9b9e549a88839487130c416036bb27c1a
This commit is contained in:
Erik Olof Gunnar Andersson 2017-06-07 00:38:03 -07:00
parent 17da9c283f
commit dae4a1b28c
5 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/neutron-lbaas-dashboard.git
project=openstack/octavia-dashboard.git

View File

@ -14,7 +14,8 @@
from __future__ import absolute_import
from django.utils.datastructures import SortedDict
import collections
from django.utils.translation import ugettext_lazy as _
from horizon import messages
@ -473,13 +474,13 @@ def _pool_list(request, expand_subnet=False, expand_vip=False, **kwargs):
pools = neutronclient(request).list_pools(**kwargs).get('pools')
if expand_subnet:
subnets = neutron.subnet_list(request)
subnet_dict = SortedDict((s.id, s) for s in subnets)
subnet_dict = collections.OrderedDict((s.id, s) for s in subnets)
for p in pools:
subnet = subnet_dict.get(p['subnet_id'])
p['subnet_name'] = subnet.cidr if subnet else None
if expand_vip:
vips = vip_list(request)
vip_dict = SortedDict((v.id, v) for v in vips)
vip_dict = collections.OrderedDict((v.id, v) for v in vips)
for p in pools:
p['vip_name'] = _get_vip(request, p, vip_dict,
expand_name_only=True)
@ -629,7 +630,7 @@ def _member_list(request, expand_pool, **kwargs):
members = neutronclient(request).list_members(**kwargs).get('members')
if expand_pool:
pools = _pool_list(request)
pool_dict = SortedDict((p.id, p) for p in pools)
pool_dict = collections.OrderedDict((p.id, p) for p in pools)
for m in members:
m['pool_name'] = pool_dict.get(m['pool_id']).name_or_id
return [Member(m) for m in members]

View File

@ -13,4 +13,4 @@
# under the License.
from . create_lb import * # noqa
from update_lb import * # noqa
from . update_lb import * # noqa

View File

@ -14,7 +14,7 @@
from django.utils.translation import ugettext as _
from neutron_lbaas_dashboard import api
from create_lb import * # noqa
from . create_lb import * # noqa
INDEX_URL = "horizon:projects:loadbalancersv2:index"

View File

@ -3,7 +3,6 @@
# process, which may cause wedges in the gate later.
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
http://tarballs.openstack.org/horizon/horizon-master.tar.gz#egg=horizon
coverage>=4.0 # Apache-2.0
ddt>=1.0.1 # MIT