On 01/31/2013 04:18 PM, Jan Cholasta wrote:
Hi,

these patches implement attribute name case preservation in LDAPEntry.
Apply on top of Petr Viktorin's LDAP code refactoring patchset (up to
part 5).

Honza

Patches 99 & 101 need some tests to make sure the _names work correctly.

Since you can call LDAPEntry.__init__ in different ways which don't always correspond to the argument names, it would be nice to explain them in a docstring.

A few nitpicks below.

freeipa-jcholast-99-Preserve-case-of-attribute-names-in-LDAPEntry.patch

diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index 20c11b4..6268ac0 100644
@@ -650,14 +637,48 @@ class LDAPEntry(dict):
          self._orig = self
          self._orig = deepcopy(self)

+    def _attr_name(self, name):
+        if not isinstance(name, (unicode, str)):

Use basestring instead of (unicode, str).


freeipa-jcholast-100-Aggregate-IPASimpleLDAPObject-in-LDAPEntry.patch

diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index 6268ac0..01fa0c1 100644
@@ -595,8 +600,10 @@ class LDAPEntry(dict):
                  _obj = {}
              orig = None

+        assert isinstance(_conn, IPASimpleLDAPObject)
          assert isinstance(_dn, DN)

+        self._conn = lambda: _conn  # do not deepcopy me!

This would be better done by overriding __deepcopy__, or just using a custom method for the copying.


--
PetrĀ³

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to