Python 3: do not index a dict_values object

In Python 3, dict.values() return a dict_values object instead of a list, as in
Python 2. This object cannot be indexed.

Change-Id: Ia4fdb4cafb1811c55dc8f14e303ab2db1b1110b3
Blueprint: neutron-python3
This commit is contained in:
Cyril Roelandt 2015-05-19 16:16:38 +00:00 committed by Cyril Roelandt
parent 5be084393b
commit 211c390404
2 changed files with 2 additions and 2 deletions

View File

@ -134,7 +134,7 @@ class OvsdbIdl(api.API):
@property
def _ovs(self):
return self._tables['Open_vSwitch'].rows.values()[0]
return list(self._tables['Open_vSwitch'].rows.values())[0]
def transaction(self, check_error=False, log_errors=True, **kwargs):
return Transaction(self, OvsdbIdl.ovsdb_connection,

View File

@ -144,7 +144,7 @@ class DbGetCommand(DbCommand):
DbCommand.result.fset(self, val)
# DbCommand will return [{'column': value}] and we just want value.
if self._result:
self._result = self._result[0].values()[0]
self._result = list(self._result[0].values())[0]
class BrExistsCommand(DbCommand):