summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-10-31 16:34:23 +0100
committerThomas Haller <thaller@redhat.com>2014-10-31 16:39:00 +0100
commit0923769285ba6e5f665a3c9b5f01b17d1be34d5b (patch)
tree788e589e2261440af5a5f3527bb8d80bfc3d3283
parent4f9e2e960372fa116931bcc06563a9c3c638dbd7 (diff)
downloadNetworkManager-0923769285ba6e5f665a3c9b5f01b17d1be34d5b.tar.gz
test,examples: fix scripts to avoid 'has_key' for Python 3
'has_key' on Dictionaries is removed from Python3 in favor of 'in'. Signed-off-by: Thomas Haller <thaller@redhat.com>
-rwxr-xr-xexamples/python/dbus/update-ip4-method.py2
-rwxr-xr-xtools/test-networkmanager-service.py12
2 files changed, 7 insertions, 7 deletions
diff --git a/examples/python/dbus/update-ip4-method.py b/examples/python/dbus/update-ip4-method.py
index 243738c5c8..bf14f7f9cc 100755
--- a/examples/python/dbus/update-ip4-method.py
+++ b/examples/python/dbus/update-ip4-method.py
@@ -58,7 +58,7 @@ for c_path in settings.ListConnections():
continue
# add IPv4 setting if it doesn't yet exist
- if not c_settings.has_key('ipv4'):
+ if 'ipv4' not in c_settings:
c_settings['ipv4'] = {}
# set the method and change properties
diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py
index 64701e7ce8..564533895d 100755
--- a/tools/test-networkmanager-service.py
+++ b/tools/test-networkmanager-service.py
@@ -711,16 +711,16 @@ class NetworkManager(ExportedObj):
raise UnknownDeviceException("No device found for the requested iface.")
# See if we need secrets. For the moment, we only support WPA
- if hash.has_key('802-11-wireless-security'):
+ if '802-11-wireless-security' in hash:
s_wsec = hash['802-11-wireless-security']
- if (s_wsec['key-mgmt'] == 'wpa-psk' and not s_wsec.has_key('psk')):
+ if (s_wsec['key-mgmt'] == 'wpa-psk' and 'psk' not in s_wsec):
secrets = agent_manager.get_secrets(hash, conpath, '802-11-wireless-security')
if secrets is None:
raise NoSecretsException("No secret agent available")
- if not secrets.has_key('802-11-wireless-security'):
+ if '802-11-wireless-security' not in secrets:
raise NoSecretsException("No secrets provided")
s_wsec = secrets['802-11-wireless-security']
- if not s_wsec.has_key('psk'):
+ if 'psk' not in s_wsec:
raise NoSecretsException("No secrets provided")
ac = ActiveConnection(self._bus, device, connection, None)
@@ -930,10 +930,10 @@ class Connection(dbus.service.Object):
def __init__(self, bus, object_path, settings, remove_func):
dbus.service.Object.__init__(self, bus, object_path)
- if not settings.has_key('connection'):
+ if 'connection' not in settings:
raise MissingSettingException('connection: setting is required')
s_con = settings['connection']
- if not s_con.has_key('type'):
+ if 'type' not in s_con:
raise MissingPropertyException('connection.type: property is required')
type = s_con['type']
if not type in ['802-3-ethernet', '802-11-wireless', 'vlan', 'wimax']: