Hi,

these patches remove the Entry and Entity classes and move instantiation of LDAPEntry objects to LDAPConnection.make_entry factory method.


Apply on top of Petr Viktorin's LDAP code refactoring (part 1 & 2) patches.

Honza

--
Jan Cholasta

>From 437ed20f7a1f483f3dd20e4d80731571acddaf06 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
Date: Tue, 22 Jan 2013 09:28:25 +0100
Subject: [PATCH 1/3] Add make_entry factory method to LDAPConnection.

Replace all occurences of Entry instantiation with calls to make_entry.
---
 ipaserver/install/adtrustinstance.py | 17 ++++++++---------
 ipaserver/install/cainstance.py      |  2 +-
 ipaserver/install/dsinstance.py      |  2 +-
 ipaserver/install/krbinstance.py     |  7 +++----
 ipaserver/install/ldapupdate.py      |  4 ++--
 ipaserver/install/replication.py     | 18 +++++++++---------
 ipaserver/install/service.py         |  4 ++--
 ipaserver/ipaldap.py                 |  7 +++++++
 8 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/ipaserver/install/adtrustinstance.py b/ipaserver/install/adtrustinstance.py
index 16f2136..91e40c8 100644
--- a/ipaserver/install/adtrustinstance.py
+++ b/ipaserver/install/adtrustinstance.py
@@ -22,7 +22,6 @@ import errno
 import ldap
 import tempfile
 import uuid
-from ipaserver import ipaldap
 from ipaserver.install import installutils
 from ipaserver.install import service
 from ipaserver.install.dsinstance import realm_to_serverid
@@ -327,7 +326,7 @@ class ADTRUSTInstance(service.Service):
             try:
                 self.admin_conn.getEntry(new_dn, ldap.SCOPE_BASE)
             except errors.NotFound:
-                entry = ipaldap.Entry(new_dn)
+                entry = self.admin_conn.make_entry(new_dn)
                 entry.setValues("objectclass", ["nsContainer"])
                 try:
                     name = new_dn[1].attr
@@ -338,7 +337,7 @@ class ADTRUSTInstance(service.Service):
                 entry.setValues("cn", name)
                 self.admin_conn.addEntry(entry)
 
-        entry = ipaldap.Entry(self.smb_dom_dn)
+        entry = self.admin_conn.make_entry(self.smb_dom_dn)
         entry.setValues("objectclass", [self.OBJC_DOMAIN, "nsContainer"])
         entry.setValues("cn", self.domain_name)
         entry.setValues(self.ATTR_FLAT_NAME, self.netbios_name)
@@ -415,7 +414,7 @@ class ADTRUSTInstance(service.Service):
                         ('cn', 'etc'), self.suffix)
         try:
             targets = self.admin_conn.getEntry(targets_dn, ldap.SCOPE_BASE)
-            current = ipaldap.Entry((targets_dn, targets.toDict()))
+            current = self.admin_conn.make_entry(targets_dn, targets.toDict())
             members = current.getValues('memberPrincipal') or []
             if not(self.cifs_principal in members):
                 current.setValues("memberPrincipal", members + [self.cifs_principal])
@@ -447,13 +446,13 @@ class ADTRUSTInstance(service.Service):
             # the principal's proper dn as defined in self.cifs_agent
             try:
                 entry = self.admin_conn.getEntry(self.smb_dn, ldap.SCOPE_BASE)
-                current = ipaldap.Entry((self.smb_dn, entry.toDict()))
+                current = self.admin_conn.make_entry(self.smb_dn, entry.toDict())
                 members = current.getValues('member') or []
                 if not(self.cifs_agent in members):
                     current.setValues("member", members + [self.cifs_agent])
                     self.admin_conn.updateEntry(self.smb_dn, entry.toDict(), current.toDict())
             except errors.NotFound:
-                entry = ipaldap.Entry(self.smb_dn)
+                entry = self.admin_conn.make_entry(self.smb_dn)
                 entry.setValues("objectclass", ["top", "GroupOfNames"])
                 entry.setValues("cn", self.smb_dn['cn'])
                 entry.setValues("member", [self.cifs_agent])
@@ -735,9 +734,9 @@ class ADTRUSTInstance(service.Service):
                              "range.\nAdd local ID range manually and try " \
                              "again!")
 
-        entry = ipaldap.Entry(DN(('cn', ('%s_id_range' % self.realm)),
-                                 api.env.container_ranges,
-                                 self.suffix))
+        entry = self.admin_conn.make_entry(DN(('cn', ('%s_id_range' % self.realm)),
+                                              api.env.container_ranges,
+                                              self.suffix))
         entry.setValue('objectclass', 'ipaDomainIDRange')
         entry.setValue('cn', ('%s_id_range' % self.realm))
         entry.setValue('ipaBaseID', str(base_id))
diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py
index 884ff26..dc4edbb 100644
--- a/ipaserver/install/cainstance.py
+++ b/ipaserver/install/cainstance.py
@@ -393,7 +393,7 @@ class CADSInstance(service.Service):
                (ldap.MOD_ADD, "nsslapd-secureport", str(DEFAULT_DSPORT+1))]
         conn.modify_s(DN(('cn', 'config')), mod)
 
-        entry = ipaldap.Entry(DN(('cn', 'RSA'), ('cn', 'encryption'), ('cn', 'config')))
+        entry = conn.make_entry(DN(('cn', 'RSA'), ('cn', 'encryption'), ('cn', 'config')))
 
         entry.setValues("objectclass", "top", "nsEncryptionModule")
         entry.setValues("cn", "RSA")
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index d030296..1d8a1df 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -569,7 +569,7 @@ class DsInstance(service.Service):
         mod = [(ldap.MOD_ADD, "nsslapd-security", "on")]
         conn.modify_s(DN(('cn', 'config')), mod)
 
-        entry = ipaldap.Entry(DN(('cn', 'RSA'), ('cn', 'encryption'), ('cn', 'config')))
+        entry = conn.make_entry(DN(('cn', 'RSA'), ('cn', 'encryption'), ('cn', 'config')))
 
         entry.setValues("objectclass", "top", "nsEncryptionModule")
         entry.setValues("cn", "RSA")
diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py
index d783da0..43fe2b1 100644
--- a/ipaserver/install/krbinstance.py
+++ b/ipaserver/install/krbinstance.py
@@ -34,7 +34,6 @@ from ipalib import errors
 from ipapython.ipa_log_manager import *
 from ipapython.dn import DN
 
-from ipaserver import ipaldap
 from ipaserver.install import replication
 from ipaserver.install import dsinstance
 
@@ -110,7 +109,7 @@ class KrbInstance(service.Service):
 
         # Create a host entry for this master
         host_dn = DN(('fqdn', self.fqdn), ('cn', 'computers'), ('cn', 'accounts'), self.suffix)
-        host_entry = ipaldap.Entry(host_dn)
+        host_entry = self.admin_conn.make_entry(host_dn)
         host_entry.setValues('objectclass', ['top', 'ipaobject', 'nshost', 'ipahost', 'ipaservice', 'pkiuser', 'krbprincipalaux', 'krbprincipal', 'krbticketpolicyaux', 'ipasshhost'])
         host_entry.setValues('krbextradata', service_entry.getValues('krbextradata'))
         host_entry.setValue('krblastpwdchange', service_entry.getValue('krblastpwdchange'))
@@ -265,7 +264,7 @@ class KrbInstance(service.Service):
             root_logger.critical("Error while enumerating SASL mappings %s" % str(e))
             raise e
 
-        entry = ipaldap.Entry(DN(('cn', 'Full Principal'), ('cn', 'mapping'), ('cn', 'sasl'), ('cn', 'config')))
+        entry = self.admin_conn.make_entry(DN(('cn', 'Full Principal'), ('cn', 'mapping'), ('cn', 'sasl'), ('cn', 'config')))
         entry.setValues("objectclass", "top", "nsSaslMapping")
         entry.setValues("cn", "Full Principal")
         entry.setValues("nsSaslMapRegexString", '\(.*\)@\(.*\)')
@@ -278,7 +277,7 @@ class KrbInstance(service.Service):
             root_logger.critical("failed to add Full Principal Sasl mapping")
             raise e
 
-        entry = ipaldap.Entry(DN(('cn', 'Name Only'), ('cn', 'mapping'), ('cn', 'sasl'), ('cn', 'config')))
+        entry = self.admin_conn.make_entry(DN(('cn', 'Name Only'), ('cn', 'mapping'), ('cn', 'sasl'), ('cn', 'config')))
         entry.setValues("objectclass", "top", "nsSaslMapping")
         entry.setValues("cn", "Name Only")
         entry.setValues("nsSaslMapRegexString", '^[^:@]+$')
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index 0d26064..d2a23e5 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -449,7 +449,7 @@ class LDAPUpdate:
         cn = "indextask_%s_%s_%s" % (attribute, cn_uuid.time, cn_uuid.clock_seq)
         dn = DN(('cn', cn), ('cn', 'index'), ('cn', 'tasks'), ('cn', 'config'))
 
-        e = ipaldap.Entry(dn)
+        e = self.conn.make_entry(dn)
 
         e.setValues('objectClass', ['top', 'extensibleObject'])
         e.setValue('cn', cn)
@@ -511,7 +511,7 @@ class LDAPUpdate:
            The return type is Entity
         """
         assert isinstance(dn, DN)
-        entry = ipaldap.Entry(dn)
+        entry = self.conn.make_entry(dn)
 
         if not default:
             # This means that the entire entry needs to be created with add
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index fdd5c0b..35c8d91 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -287,7 +287,7 @@ class ReplicationManager(object):
         rdn_attr = dn[0].attr
         rdn_val = dn[0].value
 
-        ent = ipaldap.Entry(dn)
+        ent = conn.make_entry(dn)
         ent.setValues("objectclass", "top", "person")
         ent.setValues(rdn_attr, rdn_val)
         ent.setValues("userpassword", pw)
@@ -337,7 +337,7 @@ class ReplicationManager(object):
 
         replica_type = self.get_replica_type()
 
-        entry = ipaldap.Entry(dn)
+        entry = conn.make_entry(dn)
         entry.setValues('objectclass', "top", "nsds5replica", "extensibleobject")
         entry.setValues('cn', "replica")
         entry.setValues('nsds5replicaroot', str(self.suffix))
@@ -352,7 +352,7 @@ class ReplicationManager(object):
     def setup_changelog(self, conn):
         dn = DN(('cn', 'changelog5'), ('cn', 'config'))
         dirpath = conn.dbdir + "/cldb"
-        entry = ipaldap.Entry(dn)
+        entry = conn.make_entry(dn)
         entry.setValues('objectclass', "top", "extensibleobject")
         entry.setValues('cn', "changelog5")
         entry.setValues('nsslapd-changelogdir', dirpath)
@@ -372,7 +372,7 @@ class ReplicationManager(object):
             try:
                 cn = benamebase + str(benum) # e.g. localdb1
                 dn = DN(('cn', cn), chaindn)
-                entry = ipaldap.Entry(dn)
+                entry = self.conn.make_entry(dn)
                 entry.setValues('objectclass', 'top', 'extensibleObject', 'nsBackendInstance')
                 entry.setValues('cn', cn)
                 entry.setValues('nsslapd-suffix', str(self.suffix))
@@ -444,7 +444,7 @@ class ReplicationManager(object):
             pass
 
         # The user doesn't exist, add it
-        entry = ipaldap.Entry(pass_dn)
+        entry = conn.make_entry(pass_dn)
         entry.setValues("objectclass", ["account", "simplesecurityobject"])
         entry.setValues("uid", "passsync")
         entry.setValues("userPassword", password)
@@ -516,7 +516,7 @@ class ReplicationManager(object):
         except errors.NotFound:
             pass
 
-        entry = ipaldap.Entry(dn)
+        entry = a_conn.make_entry(dn)
         entry.setValues('objectclass', "nsds5replicationagreement")
         entry.setValues('cn', cn)
         entry.setValues('nsds5replicahost', b_hostname)
@@ -912,7 +912,7 @@ class ReplicationManager(object):
 
         # Add winsync replica to the public DIT
         dn = DN(('cn',ad_dc_name),('cn','replicas'),('cn','ipa'),('cn','etc'), self.suffix)
-        entry = ipaldap.Entry(dn)
+        entry = self.conn.make_entry(dn)
         entry.setValues("objectclass", ["nsContainer", "ipaConfigObject"])
         entry.setValues("cn", ad_dc_name)
         entry.setValues("ipaConfigString", "winsync:%s" % self.hostname)
@@ -1167,7 +1167,7 @@ class ReplicationManager(object):
         root_logger.debug("Creating CLEANALLRUV task for replica id %d" % replicaId)
 
         dn = DN(('cn', 'clean %d' % replicaId), ('cn', 'cleanallruv'),('cn', 'tasks'), ('cn', 'config'))
-        e = ipaldap.Entry(dn)
+        e = self.conn.make_entry(dn)
         e.setValues('objectclass', ['top', 'extensibleObject'])
         e.setValue('replica-base-dn', api.env.basedn)
         e.setValue('replica-id', replicaId)
@@ -1190,7 +1190,7 @@ class ReplicationManager(object):
         root_logger.debug("Creating task to abort a CLEANALLRUV operation for replica id %d" % replicaId)
 
         dn = DN(('cn', 'abort %d' % replicaId), ('cn', 'abort cleanallruv'),('cn', 'tasks'), ('cn', 'config'))
-        e = ipaldap.Entry(dn)
+        e = self.conn.make_entry(dn)
         e.setValues('objectclass', ['top', 'extensibleObject'])
         e.setValue('replica-base-dn', api.env.basedn)
         e.setValue('replica-id', replicaId)
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py
index 88b47da..756b664 100644
--- a/ipaserver/install/service.py
+++ b/ipaserver/install/service.py
@@ -216,7 +216,7 @@ class Service(object):
 
         dn = DN(('krbprincipalname', principal), ('cn', 'services'), ('cn', 'accounts'), self.suffix)
         hostdn = DN(('fqdn', self.fqdn), ('cn', 'computers'), ('cn', 'accounts'), self.suffix)
-        entry = ipaldap.Entry(dn)
+        entry = self.admin_conn.make_entry(dn)
         entry.setValues("objectclass", ["krbprincipal", "krbprincipalaux", "krbticketpolicyaux", "ipaobject", "ipaservice", "pkiuser"])
         entry.setValue("krbprincipalname", principal)
         entry.setValue("ipauniqueid", 'autogenerate')
@@ -373,7 +373,7 @@ class Service(object):
 
         entry_name = DN(('cn', name), ('cn', fqdn), ('cn', 'masters'), ('cn', 'ipa'), ('cn', 'etc'), ldap_suffix)
         order = SERVICE_LIST[name][1]
-        entry = ipaldap.Entry(entry_name)
+        entry = self.admin_conn.make_entry(entry_name)
         entry.setValues("objectclass",
                         "nsContainer", "ipaConfigObject")
         entry.setValues("cn", name)
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index fc3e4d9..29f7d1e 100644
--- a/ipaserver/ipaldap.py
+++ b/ipaserver/ipaldap.py
@@ -946,6 +946,9 @@ class LDAPConnection(object):
         parent_dn = self.normalize_dn(parent_dn)
         return DN((primary_key, entry_attrs[primary_key]), parent_dn)
 
+    def make_entry(self, _dn=None, _obj=None, **kwargs):
+        return LDAPEntry(_dn, _obj, **kwargs)
+
     # generating filters for find_entry
     # some examples:
     # f1 = ldap2.make_filter_from_attr(u'firstName', u'Pavel')
@@ -1551,6 +1554,10 @@ class IPAdmin(LDAPConnection):
         self.__bind_with_wait(self.sasl_interactive_bind_s, timeout, None, auth_tokens)
         self.__lateinit()
 
+    def make_entry(self, _dn=None, _obj=None, **kwargs):
+        entry = super(IPAdmin, self).make_entry(_dn, _obj, **kwargs)
+        return Entry((entry.dn, entry))
+
     def getEntry(self, base, scope, filterstr='(objectClass=*)',
                  attrlist=None):
         # FIXME: for backwards compatibility only
-- 
1.8.1

>From f0f972366870829add5fbc21466bf81366c1fb86 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
Date: Tue, 22 Jan 2013 09:58:53 +0100
Subject: [PATCH 2/3] Remove the Entity class.

Move Entity functionality to LDAPEntry.
---
 ipaserver/install/ldapupdate.py | 35 ++++----------------------------
 ipaserver/ipaldap.py            | 45 +++++++++++++++++++++++++++++++++++------
 2 files changed, 43 insertions(+), 37 deletions(-)

diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index d2a23e5..a35df37 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -33,7 +33,6 @@ import pwd
 import fnmatch
 import csv
 import inspect
-import copy
 
 import krbV
 import ldap
@@ -49,29 +48,6 @@ from ipapython.ipa_log_manager import *
 from ipaserver.install.plugins import PRE_UPDATE, POST_UPDATE
 
 
-class Entity(ipaldap.Entry):
-    # TODO: Use ldap2 instead
-    def __init__(self, entrydata=None):
-        ipaldap.Entry.__init__(self, entrydata)
-        y = {}
-        for key, value in self.data.iteritems():
-            y[copy.deepcopy(key)] = copy.deepcopy(value)
-        self.orig_data = ipautil.CIDict(y)
-
-    def attrList(self):
-        """Return a list of all attributes in the entry"""
-        return self.data.keys()
-
-    def origDataDict(self):
-        """Returns a dict of the original values of the user.
-
-        Used for updates.
-        """
-        result = ipautil.CIDict(self.orig_data)
-        result['dn'] = self.dn
-        return result
-
-
 class BadSyntax(installutils.ScriptError):
     def __init__(self, value):
         self.value = value
@@ -269,18 +245,15 @@ class LDAPUpdate:
         return text
 
     def _entry_to_entity(self, ent):
-        """Tne Entry class is a bare LDAP entry. The Entity class has a lot more
-           helper functions that we need, so convert to dict and then to Entity.
-        """
-        entry = dict(ent.data)
-        entry['dn'] = ent.dn
+        entry = ent.copy()
         for key,value in entry.iteritems():
             if isinstance(value,list) or isinstance(value,tuple):
                 if len(value) == 0:
                     entry[key] = ''
                 elif len(value) == 1:
                     entry[key] = value[0]
-        return Entity(entry)
+        entry.commit()
+        return entry
 
     def _combine_updates(self, all_updates, update):
         'Combine a new update with the list of total updates'
@@ -508,7 +481,7 @@ class LDAPUpdate:
     def _create_default_entry(self, dn, default):
         """Create the default entry from the values provided.
 
-           The return type is Entity
+           The return type is ipaldap.Entry
         """
         assert isinstance(dn, DN)
         entry = self.conn.make_entry(dn)
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index 29f7d1e..08a1738 100644
--- a/ipaserver/ipaldap.py
+++ b/ipaserver/ipaldap.py
@@ -26,6 +26,7 @@ import string
 import time
 import shutil
 from decimal import Decimal
+from copy import deepcopy
 
 import ldap
 import ldap as _ldap
@@ -578,20 +579,30 @@ class IPASimpleLDAPObject(object):
 # r[0] == r.dn
 # r[1] == r.data
 class LDAPEntry(dict):
-    __slots__ = ('_dn',)
+    __slots__ = ('_dn', '_orig')
 
     def __init__(self, _dn=None, _obj=None, **kwargs):
+        super(LDAPEntry, self).__init__()
+
         if isinstance(_dn, LDAPEntry):
             assert _obj is None
+
             _obj = _dn
-            self._dn = DN(_obj._dn)    #pylint: disable=E1103
+
+            self._dn = DN(_obj._dn)
+            self._orig = _obj._orig
         else:
             assert isinstance(_dn, DN)
+
             if _obj is None:
                 _obj = {}
+
             self._dn = _dn
+            self._orig = self
+
+            self.commit()
 
-        super(LDAPEntry, self).__init__(self._init_iter(_obj, **kwargs))
+        self.update(_obj, **kwargs)
 
     # properties for Entry and Entity compatibility
     @property
@@ -608,6 +619,11 @@ class LDAPEntry(dict):
         # FIXME: for backwards compatibility only
         return self
 
+    @property
+    def orig_data(self):
+        # FIXME: for backwards compatibility only
+        return self._orig
+
     def _attr_name(self, name):
         if not isinstance(name, basestring):
             raise TypeError(
@@ -629,6 +645,9 @@ class LDAPEntry(dict):
     def copy(self):
         return LDAPEntry(self)
 
+    def commit(self):
+        self._orig = deepcopy(self)
+
     def __setitem__(self, name, value):
         super(LDAPEntry, self).__setitem__(self._attr_name(name), value)
 
@@ -725,6 +744,19 @@ class LDAPEntry(dict):
         result['dn'] = self.dn
         return result
 
+    def attrList(self):
+        """Return a list of all attributes in the entry"""
+        return self.data.keys()
+
+    def origDataDict(self):
+        """Returns a dict of the original values of the user.
+
+        Used for updates.
+        """
+        result = ipautil.CIDict(self.orig_data)
+        result['dn'] = self.dn
+        return result
+
 
 class Entry(LDAPEntry):
     """For compatibility with old code only
@@ -742,7 +774,7 @@ class Entry(LDAPEntry):
         a search result entry or a reference or None.
         If creating a new empty entry, data is the string DN."""
         if entrydata:
-            if isinstance(entrydata, (tuple, LDAPEntry)):
+            if isinstance(entrydata, tuple):
                 dn = entrydata[0]
                 data = ipautil.CIDict(entrydata[1])
             elif isinstance(entrydata, DN):
@@ -751,9 +783,10 @@ class Entry(LDAPEntry):
             elif isinstance(entrydata, basestring):
                 dn = DN(entrydata)
                 data = ipautil.CIDict()
+            elif isinstance(entrydata, LDAPEntry):
+                dn = entrydata.dn
+                data = entrydata
             elif isinstance(entrydata, dict):
-                if hasattr(entrydata, 'dn'):
-                    entrydata['dn'] = entrydata.dn
                 dn = entrydata['dn']
                 del entrydata['dn']
                 data = ipautil.CIDict(entrydata)
-- 
1.8.1

>From 2111d6a75464fdb436189c40d300a41710d95fc0 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
Date: Tue, 22 Jan 2013 15:03:12 +0100
Subject: [PATCH 3/3] Remove the Entry class.

---
 ipaserver/install/ldapupdate.py |  4 ++--
 ipaserver/ipaldap.py            | 47 -----------------------------------------
 2 files changed, 2 insertions(+), 49 deletions(-)

diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index a35df37..f7f6c05 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -481,7 +481,7 @@ class LDAPUpdate:
     def _create_default_entry(self, dn, default):
         """Create the default entry from the values provided.
 
-           The return type is ipaldap.Entry
+           The return type is ipaldap.LDAPEntry
         """
         assert isinstance(dn, DN)
         entry = self.conn.make_entry(dn)
@@ -507,7 +507,7 @@ class LDAPUpdate:
     def _get_entry(self, dn):
         """Retrieve an object from LDAP.
 
-           The return type is ipaldap.Entry
+           The return type is ipaldap.LDAPEntry
         """
         assert isinstance(dn, DN)
         searchfilter="objectclass=*"
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index 08a1738..332199e 100644
--- a/ipaserver/ipaldap.py
+++ b/ipaserver/ipaldap.py
@@ -758,49 +758,6 @@ class LDAPEntry(dict):
         return result
 
 
-class Entry(LDAPEntry):
-    """For compatibility with old code only
-
-    This class represents an LDAP Entry object.  An LDAP entry consists of
-    a DN and a list of attributes.  Each attribute consists of a name and
-    a list of values.  In python-ldap, entries are returned as a list of
-    2-tuples.  Instance variables:
-
-        * dn - DN object - the DN of the entry
-        * data - CIDict - case insensitive dict of the attributes and values
-    """
-    def __init__(self, entrydata):
-        """data is the raw data returned from the python-ldap result method, which is
-        a search result entry or a reference or None.
-        If creating a new empty entry, data is the string DN."""
-        if entrydata:
-            if isinstance(entrydata, tuple):
-                dn = entrydata[0]
-                data = ipautil.CIDict(entrydata[1])
-            elif isinstance(entrydata, DN):
-                dn = entrydata
-                data = ipautil.CIDict()
-            elif isinstance(entrydata, basestring):
-                dn = DN(entrydata)
-                data = ipautil.CIDict()
-            elif isinstance(entrydata, LDAPEntry):
-                dn = entrydata.dn
-                data = entrydata
-            elif isinstance(entrydata, dict):
-                dn = entrydata['dn']
-                del entrydata['dn']
-                data = ipautil.CIDict(entrydata)
-            else:
-                raise TypeError(
-                    "entrydata must be 2-tuple, DN, or basestring, got %s" %
-                    type(entrydata))
-        else:
-            dn = DN()
-            data = ipautil.CIDict()
-
-        super(Entry, self).__init__(dn, data)
-
-
 class LDAPConnection(object):
     """LDAP backend class
 
@@ -1587,10 +1544,6 @@ class IPAdmin(LDAPConnection):
         self.__bind_with_wait(self.sasl_interactive_bind_s, timeout, None, auth_tokens)
         self.__lateinit()
 
-    def make_entry(self, _dn=None, _obj=None, **kwargs):
-        entry = super(IPAdmin, self).make_entry(_dn, _obj, **kwargs)
-        return Entry((entry.dn, entry))
-
     def getEntry(self, base, scope, filterstr='(objectClass=*)',
                  attrlist=None):
         # FIXME: for backwards compatibility only
-- 
1.8.1

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

Reply via email to