summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/cli.py7
-rw-r--r--ipalib/config.py2
-rw-r--r--ipalib/errors.py2
-rw-r--r--ipalib/frontend.py4
-rw-r--r--ipalib/messages.py2
-rw-r--r--ipalib/plugable.py6
-rw-r--r--ipalib/plugins/aci.py2
-rw-r--r--ipalib/plugins/baseldap.py50
-rw-r--r--ipalib/plugins/batch.py2
-rw-r--r--ipalib/plugins/config.py4
-rw-r--r--ipalib/plugins/dns.py16
-rw-r--r--ipalib/plugins/otptoken.py2
-rw-r--r--ipalib/plugins/permission.py4
-rw-r--r--ipalib/plugins/service.py5
-rw-r--r--ipalib/plugins/stageuser.py6
-rw-r--r--ipalib/request.py4
-rw-r--r--ipalib/rpc.py4
-rw-r--r--ipalib/util.py2
18 files changed, 62 insertions, 62 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 9c6d570f7..afad07937 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -764,9 +764,8 @@ class help(frontend.Local):
self._builtins.append(c)
# compute maximum topic length
- self._mtl = max(
- len(s) for s in (self._topics.keys() + [c.name for c in self._builtins])
- )
+ topics = list(self._topics) + [c.name for c in self._builtins]
+ self._mtl = max(len(s) for s in topics)
super(help, self)._on_finalize()
@@ -1126,7 +1125,7 @@ class cli(backend.Executioner):
"""
Decode param values if appropriate.
"""
- for (key, value) in kw.iteritems():
+ for (key, value) in kw.items():
yield (key, self.Backend.textui.decode(value))
def build_parser(self, cmd):
diff --git a/ipalib/config.py b/ipalib/config.py
index 90933b7a2..144127467 100644
--- a/ipalib/config.py
+++ b/ipalib/config.py
@@ -330,7 +330,7 @@ class Env(object):
:param kw: Variables provides as keyword arguments.
"""
i = 0
- for (key, value) in kw.iteritems():
+ for (key, value) in kw.items():
if key not in self:
self[key] = value
i += 1
diff --git a/ipalib/errors.py b/ipalib/errors.py
index e7b016674..2f7c77c1c 100644
--- a/ipalib/errors.py
+++ b/ipalib/errors.py
@@ -117,7 +117,7 @@ class PrivateError(StandardError):
def __init__(self, **kw):
self.msg = self.format % kw
self.kw = kw
- for (key, value) in kw.iteritems():
+ for (key, value) in kw.items():
assert not hasattr(self, key), 'conflicting kwarg %s.%s = %r' % (
self.__class__.__name__, key, value,
)
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index 16ec9cce8..8cc0dd7b2 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -614,7 +614,7 @@ class Command(HasParam):
{'last': u'DOE', 'first': u'john'}
"""
return dict(
- (k, self.params[k].normalize(v)) for (k, v) in kw.iteritems()
+ (k, self.params[k].normalize(v)) for (k, v) in kw.items()
)
def convert(self, **kw):
@@ -634,7 +634,7 @@ class Command(HasParam):
{'two': u'2', 'one': 1}
"""
return dict(
- (k, self.params[k].convert(v)) for (k, v) in kw.iteritems()
+ (k, self.params[k].convert(v)) for (k, v) in kw.items()
)
def __convert_iter(self, kw):
diff --git a/ipalib/messages.py b/ipalib/messages.py
index 4615cbc2b..c932b30f7 100644
--- a/ipalib/messages.py
+++ b/ipalib/messages.py
@@ -85,7 +85,7 @@ def process_message_arguments(obj, format=None, message=None, **kw):
obj.forwarded = True
obj.msg = message
obj.strerror = message
- for (key, value) in kw.iteritems():
+ for (key, value) in kw.items():
assert not hasattr(obj, key), 'conflicting kwarg %s.%s = %r' % (
name, key, value,
)
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 17c78dce6..3f65f6736 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -659,7 +659,7 @@ class API(ReadOnly):
sub_d = self.__plugins.get(base, {})
members = []
- for klass in sub_d.itervalues():
+ for klass in sub_d.values():
try:
instance = plugins[klass]
except KeyError:
@@ -673,7 +673,7 @@ class API(ReadOnly):
assert not hasattr(self, name)
setattr(self, name, NameSpace(members))
- for klass, instance in plugins.iteritems():
+ for klass, instance in plugins.items():
if not production_mode:
assert instance.api is self
if klass.finalize_early or not self.env.plugins_on_demand:
@@ -682,7 +682,7 @@ class API(ReadOnly):
assert islocked(instance)
self.__finalized = True
- self.plugins = tuple((k, tuple(v)) for k, v in plugin_info.iteritems())
+ self.plugins = tuple((k, tuple(v)) for k, v in plugin_info.items())
if not production_mode:
lock(self)
diff --git a/ipalib/plugins/aci.py b/ipalib/plugins/aci.py
index 0ff28b84e..cdc8f7092 100644
--- a/ipalib/plugins/aci.py
+++ b/ipalib/plugins/aci.py
@@ -223,7 +223,7 @@ def _make_aci(ldap, current, aciname, kw):
if 'aciprefix' not in kw:
raise errors.ValidationError(name='aciprefix', error=_('ACI prefix is required'))
- if sum(valid.itervalues()) == 0:
+ if sum(valid.values()) == 0:
raise errors.ValidationError(name='target', error=_('at least one of: type, filter, subtree, targetgroup, attrs or memberof are required'))
if valid['filter'] + valid['memberof'] > 1:
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index a8525e81e..59d39c403 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -232,7 +232,7 @@ def entry_from_entry(entry, newentry):
"""
# Wipe out the current data
- for e in entry.keys():
+ for e in list(entry):
del entry[e]
# Re-populate it with new wentry
@@ -242,7 +242,7 @@ def entry_from_entry(entry, newentry):
def entry_to_dict(entry, **options):
if options.get('raw', False):
result = {}
- for attr in entry.iterkeys():
+ for attr in entry:
if attr.lower() == 'attributelevelrights':
value = entry[attr]
elif entry.conn.get_attribute_type(attr) is str:
@@ -256,7 +256,7 @@ def entry_to_dict(entry, **options):
pass
result[attr] = value
else:
- result = dict((k.lower(), v) for (k, v) in entry.iteritems())
+ result = dict((k.lower(), v) for (k, v) in entry.items())
if options.get('all', False):
result['dn'] = entry.dn
return result
@@ -793,10 +793,10 @@ class LDAPObject(Object):
attrs = self.api.Backend.ldap2.schema.attribute_types(objectclasses)
attrlist = []
# Go through the MUST first
- for (oid, attr) in attrs[0].iteritems():
+ for (oid, attr) in attrs[0].items():
attrlist.append(attr.names[0].lower())
# And now the MAY
- for (oid, attr) in attrs[1].iteritems():
+ for (oid, attr) in attrs[1].items():
attrlist.append(attr.names[0].lower())
json_dict['aciattrs'] = attrlist
attrlist.sort()
@@ -809,7 +809,7 @@ class LDAPObject(Object):
# addattr can cause parameters to have more than one value even if not defined
# as multivalue, make sure this isn't the case
def _check_single_value_attrs(params, entry_attrs):
- for (a, v) in entry_attrs.iteritems():
+ for (a, v) in entry_attrs.items():
if isinstance(v, (list, tuple)) and len(v) > 1:
if a in params and not params[a].multivalue:
raise errors.OnlyOneValueAllowed(attr=a)
@@ -817,7 +817,7 @@ def _check_single_value_attrs(params, entry_attrs):
# setattr or --option='' can cause parameters to be empty that are otherwise
# required, make sure we enforce that.
def _check_empty_attrs(params, entry_attrs):
- for (a, v) in entry_attrs.iteritems():
+ for (a, v) in entry_attrs.items():
if v is None or (isinstance(v, six.string_types) and len(v) == 0):
if a in params and params[a].required:
raise errors.RequirementError(name=a)
@@ -839,7 +839,7 @@ def _check_limit_object_class(attributes, attrs, allow_only):
return
limitattrs = deepcopy(attrs)
# Go through the MUST first
- for (oid, attr) in attributes[0].iteritems():
+ for (oid, attr) in attributes[0].items():
if attr.names[0].lower() in limitattrs:
if not allow_only:
raise errors.ObjectclassViolation(
@@ -847,7 +847,7 @@ def _check_limit_object_class(attributes, attrs, allow_only):
attribute=attr.names[0].lower()))
limitattrs.remove(attr.names[0].lower())
# And now the MAY
- for (oid, attr) in attributes[1].iteritems():
+ for (oid, attr) in attributes[1].items():
if attr.names[0].lower() in limitattrs:
if not allow_only:
raise errors.ObjectclassViolation(
@@ -1015,9 +1015,9 @@ last, after all sets and adds."""),
setdict = self._convert_2_dict(ldap, options.get('setattr', []))
deldict = self._convert_2_dict(ldap, options.get('delattr', []))
- setattrs = set(setdict.keys())
- addattrs = set(adddict.keys())
- delattrs = set(deldict.keys())
+ setattrs = set(setdict)
+ addattrs = set(adddict)
+ delattrs = set(deldict)
if dn is None:
direct_add = addattrs
@@ -1029,7 +1029,7 @@ last, after all sets and adds."""),
direct_del = setattrs & delattrs
needldapattrs = list((addattrs | delattrs) - setattrs)
- for attr, val in setdict.iteritems():
+ for attr, val in setdict.items():
entry_attrs[attr] = val
for attr in direct_add:
@@ -1063,7 +1063,7 @@ last, after all sets and adds."""),
# Provide a nice error message when user tries to delete an
# attribute that does not exist on the entry (and user is not
# adding it)
- names = set(n.lower() for n in old_entry.keys())
+ names = set(n.lower() for n in old_entry)
del_nonexisting = delattrs - (names | setattrs | addattrs)
if del_nonexisting:
raise errors.ValidationError(name=del_nonexisting.pop(),
@@ -1229,8 +1229,8 @@ class LDAPCreate(BaseLDAPCommand, crud.Create):
*keys, **options)
_check_single_value_attrs(self.params, entry_attrs)
- _check_limit_object_class(self.api.Backend.ldap2.schema.attribute_types(self.obj.limit_object_classes), entry_attrs.keys(), allow_only=True)
- _check_limit_object_class(self.api.Backend.ldap2.schema.attribute_types(self.obj.disallow_object_classes), entry_attrs.keys(), allow_only=False)
+ _check_limit_object_class(self.api.Backend.ldap2.schema.attribute_types(self.obj.limit_object_classes), list(entry_attrs), allow_only=True)
+ _check_limit_object_class(self.api.Backend.ldap2.schema.attribute_types(self.obj.disallow_object_classes), list(entry_attrs), allow_only=False)
try:
self._exc_wrapper(keys, options, ldap.add_entry)(entry_attrs)
@@ -1469,8 +1469,8 @@ class LDAPUpdate(LDAPQuery, crud.Update):
self, ldap, entry_attrs.dn, entry_attrs, attrs_list,
*keys, **options)
- _check_limit_object_class(self.api.Backend.ldap2.schema.attribute_types(self.obj.limit_object_classes), entry_attrs.keys(), allow_only=True)
- _check_limit_object_class(self.api.Backend.ldap2.schema.attribute_types(self.obj.disallow_object_classes), entry_attrs.keys(), allow_only=False)
+ _check_limit_object_class(self.api.Backend.ldap2.schema.attribute_types(self.obj.limit_object_classes), list(entry_attrs), allow_only=True)
+ _check_limit_object_class(self.api.Backend.ldap2.schema.attribute_types(self.obj.disallow_object_classes), list(entry_attrs), allow_only=False)
rdnupdate = False
try:
@@ -1505,7 +1505,7 @@ class LDAPUpdate(LDAPQuery, crud.Update):
# mean an error occurred, just that there were no other updates to
# perform.
update = self._exc_wrapper(keys, options, ldap.get_entry)(
- entry_attrs.dn, entry_attrs.keys())
+ entry_attrs.dn, list(entry_attrs))
update.update(entry_attrs)
self._exc_wrapper(keys, options, ldap.update_entry)(update)
@@ -1727,7 +1727,7 @@ class LDAPAddMember(LDAPModMember):
assert isinstance(dn, DN)
completed = 0
- for (attr, objs) in member_dns.iteritems():
+ for (attr, objs) in member_dns.items():
for ldap_obj_name in objs:
for m_dn in member_dns[attr][ldap_obj_name]:
assert isinstance(m_dn, DN)
@@ -1828,8 +1828,8 @@ class LDAPRemoveMember(LDAPModMember):
assert isinstance(dn, DN)
completed = 0
- for (attr, objs) in member_dns.iteritems():
- for ldap_obj_name, m_dns in objs.iteritems():
+ for (attr, objs) in member_dns.items():
+ for ldap_obj_name, m_dns in objs.items():
for m_dn in m_dns:
assert isinstance(m_dn, DN)
if not m_dn:
@@ -2376,7 +2376,7 @@ class LDAPModAttribute(LDAPQuery):
try:
update = self._exc_wrapper(keys, options, ldap.get_entry)(
- entry_attrs.dn, entry_attrs.keys())
+ entry_attrs.dn, list(entry_attrs))
self._update_attrs(update, entry_attrs)
self._exc_wrapper(keys, options, ldap.update_entry)(update)
@@ -2425,7 +2425,7 @@ class LDAPAddAttribute(LDAPModAttribute):
msg_summary = _('added attribute value to entry %(value)')
def _update_attrs(self, update, entry_attrs):
- for name, value in entry_attrs.iteritems():
+ for name, value in entry_attrs.items():
old_value = set(update.get(name, []))
value_to_add = set(value)
@@ -2442,7 +2442,7 @@ class LDAPRemoveAttribute(LDAPModAttribute):
msg_summary = _('removed attribute values from entry %(value)')
def _update_attrs(self, update, entry_attrs):
- for name, value in entry_attrs.iteritems():
+ for name, value in entry_attrs.items():
old_value = set(update.get(name, []))
value_to_remove = set(value)
diff --git a/ipalib/plugins/batch.py b/ipalib/plugins/batch.py
index 9b9ab6544..ddf24839d 100644
--- a/ipalib/plugins/batch.py
+++ b/ipalib/plugins/batch.py
@@ -97,7 +97,7 @@ class batch(Command):
if name not in self.Command:
raise errors.CommandError(name=name)
a, kw = arg['params']
- newkw = dict((str(k), v) for k, v in kw.iteritems())
+ newkw = dict((str(k), v) for k, v in kw.items())
params = api.Command[name].args_options_2_params(*a, **newkw)
newkw.setdefault('version', options['version'])
diff --git a/ipalib/plugins/config.py b/ipalib/plugins/config.py
index 6267313d5..c8153c311 100644
--- a/ipalib/plugins/config.py
+++ b/ipalib/plugins/config.py
@@ -256,8 +256,8 @@ class config_mod(LDAPUpdate):
if 'ipagroupsearchfields' in entry_attrs:
kw['ipagroupsearchfields'] = 'ipagroupobjectclasses'
if kw:
- config = ldap.get_ipa_config(kw.values())
- for (k, v) in kw.iteritems():
+ config = ldap.get_ipa_config(list(kw.values()))
+ for (k, v) in kw.items():
allowed_attrs = ldap.get_allowed_attributes(config[v])
fields = entry_attrs[k].split(',')
for a in fields:
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index 10c4987af..6044d3823 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -1641,7 +1641,7 @@ def _create_idn_filter(cmd, ldap, *args, **options):
search_kw = {}
attr_extra_filters = []
- for attr, value in cmd.args_options_2_entry(**options).iteritems():
+ for attr, value in cmd.args_options_2_entry(**options).items():
if not isinstance(value, list):
value = [value]
for i, v in enumerate(value):
@@ -3245,11 +3245,11 @@ class dnsrecord(LDAPObject):
"""
rrattrs = {}
if old_entry is not None:
- old_rrattrs = dict((key, value) for key, value in old_entry.iteritems()
+ old_rrattrs = dict((key, value) for key, value in old_entry.items()
if key in self.params and
isinstance(self.params[key], DNSRecord))
rrattrs.update(old_rrattrs)
- new_rrattrs = dict((key, value) for key, value in entry_attrs.iteritems()
+ new_rrattrs = dict((key, value) for key, value in entry_attrs.items()
if key in self.params and
isinstance(self.params[key], DNSRecord))
rrattrs.update(new_rrattrs)
@@ -3267,7 +3267,7 @@ class dnsrecord(LDAPObject):
'(RFC 2136, section 1.1.5)'))
if any(rrvalue is not None
and rrattr != 'cnamerecord'
- for rrattr, rrvalue in rrattrs.iteritems()):
+ for rrattr, rrvalue in rrattrs.items()):
raise errors.ValidationError(name='cnamerecord',
error=_('CNAME record is not allowed to coexist '
'with any other record (RFC 1034, section 3.6.2)'))
@@ -3327,7 +3327,7 @@ class dnsrecord(LDAPObject):
# all records were deleted => name should not exist in DNS
return None
- for attr, value in entry_attrs.iteritems():
+ for attr, value in entry_attrs.items():
if not attr.endswith(record_attr_suf):
continue
@@ -3444,7 +3444,7 @@ class dnsrecord(LDAPObject):
# name should not exist => ask for A record and check result
ldap_rrsets = {dns.rdatatype.from_text('A'): None}
- for rdtype, ldap_rrset in ldap_rrsets.iteritems():
+ for rdtype, ldap_rrset in ldap_rrsets.items():
try:
self.wait_for_modified_attr(ldap_rrset, rdtype, dns_name)
@@ -3479,7 +3479,7 @@ class dnsrecord(LDAPObject):
:param entries:
Dict {(dns_domain, dns_name): entry_for_wait_for_modified_attrs}
'''
- for entry_name, entry in entries.iteritems():
+ for entry_name, entry in entries.items():
dns_domain = entry_name[0]
dns_name = entry_name[1].derelativize(dns_domain)
self.wait_for_modified_attrs(entry, dns_name, dns_domain)
@@ -3691,7 +3691,7 @@ class dnsrecord_add(LDAPCreate):
# already merged in pre_callback
ldap = self.obj.backend
entry_attrs = self.obj.get_record_entry_attrs(call_args[0])
- update = ldap.get_entry(entry_attrs.dn, entry_attrs.keys())
+ update = ldap.get_entry(entry_attrs.dn, list(entry_attrs))
update.update(entry_attrs)
ldap.update_entry(update, **call_kwargs)
return
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?',
diff --git a/ipalib/plugins/permission.py b/ipalib/plugins/permission.py
index 9544cd292..7a2e14c72 100644
--- a/ipalib/plugins/permission.py
+++ b/ipalib/plugins/permission.py
@@ -1148,7 +1148,7 @@ class permission_mod(baseldap.LDAPUpdate):
# Since `entry` only contains the attributes we are currently changing,
# it cannot be used directly to generate an ACI.
# First we need to copy the original data into it.
- for key, value in old_entry.iteritems():
+ for key, value in old_entry.items():
if (key not in options and
key != 'cn' and
key not in self.obj.attribute_members):
@@ -1355,7 +1355,7 @@ class permission_find(baseldap.LDAPSearch):
for entry in entries:
if options.get('pkey_only'):
- for opt_name in entry.keys():
+ for opt_name in list(entry):
if opt_name != self.obj.primary_key.name:
del entry[opt_name]
else:
diff --git a/ipalib/plugins/service.py b/ipalib/plugins/service.py
index 6d0299164..d20f52876 100644
--- a/ipalib/plugins/service.py
+++ b/ipalib/plugins/service.py
@@ -22,6 +22,7 @@
import base64
import os
+
from ipalib import api, errors, util
from ipalib import Str, Flag, Bytes, StrEnum, Bool
from ipalib.plugable import Registry
@@ -315,7 +316,7 @@ def check_required_principal(ldap, hostname, service):
def update_krbticketflags(ldap, entry_attrs, attrs_list, options, existing):
add = remove = 0
- for (name, value) in _ticket_flags_map.iteritems():
+ for (name, value) in _ticket_flags_map.items():
if name not in options:
continue
if options[name]:
@@ -356,7 +357,7 @@ def set_kerberos_attrs(entry_attrs, options):
all_opt = options.get('all', False)
- for (name, value) in _ticket_flags_map.iteritems():
+ for (name, value) in _ticket_flags_map.items():
if name in options or all_opt:
entry_attrs[name] = bool(ticket_flags & value)
diff --git a/ipalib/plugins/stageuser.py b/ipalib/plugins/stageuser.py
index f3788538a..2a232d1e3 100644
--- a/ipalib/plugins/stageuser.py
+++ b/ipalib/plugins/stageuser.py
@@ -639,7 +639,7 @@ class stageuser_activate(LDAPQuery):
)
except errors.NotFound:
self.obj.handle_not_found(*args)
- entry_attrs = dict((k.lower(), v) for (k, v) in entry_attrs.iteritems())
+ entry_attrs = dict((k.lower(), v) for (k, v) in entry_attrs.items())
# Check it does not exist an active entry with the same RDN
active_dn = DN(staging_dn[0], api.env.container_user, api.env.basedn)
@@ -660,7 +660,7 @@ class stageuser_activate(LDAPQuery):
# Time to build the new entry
result_entry = {'dn' : active_dn}
new_entry_attrs = self.__dict_new_entry()
- for (attr, values) in entry_attrs.iteritems():
+ for (attr, values) in entry_attrs.items():
self.__merge_values(args, options, entry_attrs, new_entry_attrs, attr)
result_entry[attr] = values
@@ -670,7 +670,7 @@ class stageuser_activate(LDAPQuery):
if result_entry['description'] == NO_UPG_MAGIC:
del result_entry['description']
- for (k,v) in new_entry_attrs.iteritems():
+ for (k, v) in new_entry_attrs.items():
self.log.debug("new entry: k=%r and v=%r)" % (k, v))
self._build_new_entry(ldap, staging_dn, entry_attrs, new_entry_attrs)
diff --git a/ipalib/request.py b/ipalib/request.py
index a83b35403..5a6baba42 100644
--- a/ipalib/request.py
+++ b/ipalib/request.py
@@ -51,8 +51,8 @@ def destroy_context():
"""
Delete all attributes on thread-local `request.context`.
"""
- # need to use .values(), 'cos value.disconnect modifies the dict
- for value in context.__dict__.values():
+ # need to use a list of values, 'cos value.disconnect modifies the dict
+ for value in list(context.__dict__.values()):
if isinstance(value, Connection):
value.disconnect()
context.__dict__.clear()
diff --git a/ipalib/rpc.py b/ipalib/rpc.py
index 0dc897a08..b76d27885 100644
--- a/ipalib/rpc.py
+++ b/ipalib/rpc.py
@@ -159,7 +159,7 @@ def xml_wrap(value, version):
return tuple(xml_wrap(v, version) for v in value)
if isinstance(value, dict):
return dict(
- (k, xml_wrap(v, version)) for (k, v) in value.iteritems()
+ (k, xml_wrap(v, version)) for (k, v) in value.items()
)
if type(value) is str:
return Binary(value)
@@ -213,7 +213,7 @@ def xml_unwrap(value, encoding='UTF-8'):
return DNSName(value['__dns_name__'])
else:
return dict(
- (k, xml_unwrap(v, encoding)) for (k, v) in value.iteritems()
+ (k, xml_unwrap(v, encoding)) for (k, v) in value.items()
)
if type(value) is str:
return value.decode(encoding)
diff --git a/ipalib/util.py b/ipalib/util.py
index e38ddbbdc..3b8e59216 100644
--- a/ipalib/util.py
+++ b/ipalib/util.py
@@ -51,7 +51,7 @@ def json_serialize(obj):
if isinstance(obj, (list, tuple)):
return [json_serialize(o) for o in obj]
if isinstance(obj, dict):
- return dict((k, json_serialize(v)) for (k, v) in obj.iteritems())
+ return {k: json_serialize(v) for (k, v) in obj.items()}
if isinstance(obj, (bool, float, int, long, unicode, NoneType)):
return obj
if isinstance(obj, str):