From e920ae22525d34e1f524e2e59159ac50c603bc8c Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Tue, 7 Feb 2017 14:11:24 +0100 Subject: [PATCH] ipaldap: preserve order of values in LDAPEntry._sync() In Python 2, the order was preserved by accident. This change makes sure the order is preserved in both Python 2 and 3. https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Martin Basti --- ipapython/ipaldap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py index c811431f1..6a4674405 100644 --- a/ipapython/ipaldap.py +++ b/ipapython/ipaldap.py @@ -292,13 +292,13 @@ class LDAPEntry(collections.MutableMapping): continue nice.remove(value) - for value in nice_adds: + for value in sorted(nice_adds, key=nice.index): value = self._conn.encode(value) if value in raw_dels: continue raw.append(value) - for value in raw_adds: + for value in sorted(raw_adds, key=raw.index): try: value = self._conn.decode(value, name) except ValueError as e: