From: Noel Power Date: Fri, 11 May 2018 15:37:44 +0000 (+0100) Subject: python/samba/tests: py2/py3 port has_keys usage X-Git-Tag: tevent-0.9.37~257 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e349fe82ad622aa856695ba0aa5d61dc2ca0d82;p=thirdparty%2Fsamba.git python/samba/tests: py2/py3 port has_keys usage Signed-off-by: Noel Power Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/upgradeprovisionneeddc.py b/python/samba/tests/upgradeprovisionneeddc.py index bf254531510..21c08ab4218 100644 --- a/python/samba/tests/upgradeprovisionneeddc.py +++ b/python/samba/tests/upgradeprovisionneeddc.py @@ -91,7 +91,7 @@ class UpgradeProvisionWithLdbTestCase(TestCaseInTempDir): hashAtt = search_constructed_attrs_stored(self.ldbs.sam, self.names.rootdn, ["msds-KeyVersionNumber"]) - self.assertFalse(hashAtt.has_key("msds-KeyVersionNumber")) + self.assertFalse("msds-KeyVersionNumber" in hashAtt) def test_increment_calculated_keyversion_number(self): dn = "CN=Administrator,CN=Users,%s" % self.names.rootdn diff --git a/python/samba/upgradehelpers.py b/python/samba/upgradehelpers.py index 14fe3e024c3..5e5655d74a2 100644 --- a/python/samba/upgradehelpers.py +++ b/python/samba/upgradehelpers.py @@ -489,7 +489,7 @@ def increment_calculated_keyversion_number(samdb, rootdn, hashDns): raise ProvisioningError("Unable to find msDs-KeyVersionNumber") else: for e in entry: - if hashDns.has_key(str(e.dn).lower()): + if str(e.dn).lower() in hashDns: val = e.get("msDs-KeyVersionNumber") if not val: val = "0" @@ -689,7 +689,7 @@ def search_constructed_attrs_stored(samdb, rootdn, attrs): for ent in entry: for att in attrs: if ent.get(att): - if hashAtt.has_key(att): + if att in hashAtt: hashAtt[att][str(ent.dn).lower()] = str(ent[att]) else: hashAtt[att] = {}