1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-31 20:22:15 +03:00

kcc: fix sort for py3

py2:

    list.sort(cmp=None, key=None, reverse=False)
    sorted(iterable[, cmp[, key[, reverse]]])

py3:

    list.sort(key=None, reverse=False)
    sorted(iterable, *, key=None, reverse=False)

The `cmp` arg was removed in py3, make use of `key` arg to work around.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Joe Guo
2018-04-10 14:51:37 +12:00
committed by Douglas Bagnall
parent 949109442f
commit c7f3c91b62
2 changed files with 4 additions and 19 deletions

View File

@ -1581,7 +1581,9 @@ class Site(object):
# Which is a fancy way of saying "sort all the nTDSDSA objects
# in the site by guid in ascending order". Place sorted list
# in D_sort[]
D_sort = sorted(self.rw_dsa_table.values(), cmp=sort_dsa_by_guid)
D_sort = sorted(
self.rw_dsa_table.values(),
key=lambda dsa: ndr_pack(dsa.dsa_guid))
# double word number of 100 nanosecond intervals since 1600s
@ -2221,11 +2223,6 @@ def get_dsa_config_rep(dsa):
dsa.dsa_dnstr)
def sort_dsa_by_guid(dsa1, dsa2):
"use ndr_pack for GUID comparison, as appears correct in some places"""
return cmp(ndr_pack(dsa1.dsa_guid), ndr_pack(dsa2.dsa_guid))
def new_connection_schedule():
"""Create a default schedule for an NTDSConnection or Sitelink. This
is packed differently from the repltimes schedule used elsewhere