]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Dictionary keys doesn't support slicing. That's throw an error in the program 151/head
authorLuis González Fernández <luisgf@luisgf.es>
Thu, 5 May 2016 19:02:52 +0000 (21:02 +0200)
committerLuis González Fernández <luisgf@luisgf.es>
Thu, 5 May 2016 19:02:52 +0000 (21:02 +0200)
if the 'keyname' parameter is not passed.

Doing a list(dict())[0] solve this problem.

dns/message.py

index 5f82b45ac26d139e632bc084c9251eba6e5f483d..1b310869f439b6db34fd737eb5eab11105f7e707 100644 (file)
@@ -467,7 +467,7 @@ class Message(object):
 
         self.keyring = keyring
         if keyname is None:
-            self.keyname = self.keyring.keys()[0]
+            self.keyname = list(self.keyring.keys())[0]
         else:
             if isinstance(keyname, string_types):
                 keyname = dns.name.from_text(keyname)