URL: https://github.com/freeipa/freeipa/pull/438
Author: HonzaCholasta
 Title: #438: ipaldap: preserve order of values in LDAPEntry._sync()
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/438/head:pr438
git checkout pr438
From 822495ea1adfc944dab824565d7d0edea61acd41 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
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
---
 ipapython/ipaldap.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py
index 497b947..108adbf 100644
--- a/ipapython/ipaldap.py
+++ b/ipapython/ipaldap.py
@@ -292,13 +292,13 @@ def _sync_attr(self, name):
                 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:
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to