summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/otptoken.py
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2015-08-11 13:51:14 +0200
committerJan Cholasta <jcholast@redhat.com>2015-09-01 11:42:01 +0200
commit3bf91eab25c602a6fad2665456f57e8629c5a6f4 (patch)
tree52f713e898a385d57a914d539a7da9a20fc20166 /ipalib/plugins/otptoken.py
parentdd16cc98b0d67f1448bf9de25f8adce512b1431c (diff)
downloadfreeipa-3bf91eab25c602a6fad2665456f57e8629c5a6f4.tar.gz
freeipa-3bf91eab25c602a6fad2665456f57e8629c5a6f4.tar.xz
freeipa-3bf91eab25c602a6fad2665456f57e8629c5a6f4.zip
Use Python3-compatible dict method names
Python 2 has keys()/values()/items(), which return lists, iterkeys()/itervalues()/iteritems(), which return iterators, and viewkeys()/viewvalues()/viewitems() which return views. Python 3 has only keys()/values()/items(), which return views. To get iterators, one can use iter() or a for loop/comprehension; for lists there's the list() constructor. When iterating through the entire dict, without modifying the dict, the difference between Python 2's items() and iteritems() is negligible, especially on small dicts (the main overhead is extra memory, not CPU time). In the interest of simpler code, this patch changes many instances of iteritems() to items(), iterkeys() to keys() etc. In other cases, helpers like six.itervalues are used. Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipalib/plugins/otptoken.py')
-rw-r--r--ipalib/plugins/otptoken.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ipalib/plugins/otptoken.py b/ipalib/plugins/otptoken.py
index eb3e3f977..3c2cb9309 100644
--- a/ipalib/plugins/otptoken.py
+++ b/ipalib/plugins/otptoken.py
@@ -161,7 +161,7 @@ class otptoken(LDAPObject):
doc=_('Type of the token'),
default=u'totp',
autofill=True,
- values=tuple(TOKEN_TYPES.keys() + [x.upper() for x in TOKEN_TYPES]),
+ values=tuple(list(TOKEN_TYPES) + [x.upper() for x in TOKEN_TYPES]),
flags=('virtual_attribute', 'no_update'),
),
Str('description?',