pylint: fix redefine-in-handler

Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
Jan Barta 2016-06-03 11:09:00 +02:00 committed by Martin Basti
parent cdecbcd0a1
commit 568f9da331
3 changed files with 12 additions and 13 deletions

View File

@ -190,9 +190,9 @@ def del_link(realm, replica1, replica2, dirman_passwd, force=False):
# Find the DN of the replication agreement to remove # Find the DN of the replication agreement to remove
replica2_dn = None replica2_dn = None
for e in repl_list: for entry in repl_list:
if e.single_value.get('nsDS5ReplicaHost') == replica1: if entry.single_value.get('nsDS5ReplicaHost') == replica1:
replica2_dn = e.dn replica2_dn = entry.dn
break break
# This should never happen # This should never happen
@ -203,8 +203,8 @@ def del_link(realm, replica1, replica2, dirman_passwd, force=False):
print("'%s' has no replication agreement for '%s'" % (replica2, replica1)) print("'%s' has no replication agreement for '%s'" % (replica2, replica1))
if not force: if not force:
return return
except Exception as e: except Exception as exc:
print("Failed to get data from '%s': %s" % (replica2, e)) print("Failed to get data from '%s': %s" % (replica2, exc))
if not force: if not force:
sys.exit(1) sys.exit(1)
@ -213,8 +213,8 @@ def del_link(realm, replica1, replica2, dirman_passwd, force=False):
try: try:
repl2.delete_agreement(replica1, replica2_dn) repl2.delete_agreement(replica1, replica2_dn)
repl2.delete_referral(replica1, repl1.port) repl2.delete_referral(replica1, repl1.port)
except Exception as e: except Exception as exc:
print("Unable to remove agreement on %s: %s" % (replica2, e)) print("Unable to remove agreement on %s: %s" % (replica2, exc))
failed = True failed = True
if failed: if failed:

View File

@ -2035,9 +2035,9 @@ class LDAPSearch(BaseLDAPCommand, crud.Search):
entries.sort(key=sort_key) entries.sort(key=sort_key)
if not options.get('raw', False): if not options.get('raw', False):
for e in entries: for entry in entries:
self.obj.get_indirect_members(e, attrs_list) self.obj.get_indirect_members(entry, attrs_list)
self.obj.convert_attribute_members(e, *args, **options) self.obj.convert_attribute_members(entry, *args, **options)
for (i, e) in enumerate(entries): for (i, e) in enumerate(entries):
entries[i] = entry_to_dict(e, **options) entries[i] = entry_to_dict(e, **options)
@ -2051,9 +2051,9 @@ class LDAPSearch(BaseLDAPCommand, crud.Search):
try: try:
ldap.handle_truncated_result(truncated) ldap.handle_truncated_result(truncated)
except errors.LimitsExceeded as e: except errors.LimitsExceeded as exc:
add_message(options['version'], result, SearchResultTruncated( add_message(options['version'], result, SearchResultTruncated(
reason=e)) reason=exc))
return result return result

View File

@ -51,7 +51,6 @@ disable=
no-init, no-init,
pointless-string-statement, pointless-string-statement,
protected-access, protected-access,
redefine-in-handler,
redefined-builtin, redefined-builtin,
redefined-outer-name, redefined-outer-name,
super-init-not-called, super-init-not-called,