Remove the Entry class.

This commit is contained in:
Jan Cholasta 2013-01-22 15:03:12 +01:00 committed by Martin Kosek
parent c1d6937ea2
commit 6896626baa
2 changed files with 2 additions and 49 deletions

View File

@ -481,7 +481,7 @@ class LDAPUpdate:
def _create_default_entry(self, dn, default): def _create_default_entry(self, dn, default):
"""Create the default entry from the values provided. """Create the default entry from the values provided.
The return type is ipaldap.Entry The return type is ipaldap.LDAPEntry
""" """
assert isinstance(dn, DN) assert isinstance(dn, DN)
entry = self.conn.make_entry(dn) entry = self.conn.make_entry(dn)
@ -507,7 +507,7 @@ class LDAPUpdate:
def _get_entry(self, dn): def _get_entry(self, dn):
"""Retrieve an object from LDAP. """Retrieve an object from LDAP.
The return type is ipaldap.Entry The return type is ipaldap.LDAPEntry
""" """
assert isinstance(dn, DN) assert isinstance(dn, DN)
searchfilter="objectclass=*" searchfilter="objectclass=*"

View File

@ -769,49 +769,6 @@ class LDAPEntry(dict):
return result 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): class LDAPConnection(object):
"""LDAP backend class """LDAP backend class
@ -1690,10 +1647,6 @@ class IPAdmin(LDAPConnection):
self.__bind_with_wait(self.sasl_interactive_bind_s, timeout, None, auth_tokens) self.__bind_with_wait(self.sasl_interactive_bind_s, timeout, None, auth_tokens)
self.__lateinit() 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=*)', def getEntry(self, base, scope, filterstr='(objectClass=*)',
attrlist=None): attrlist=None):
# FIXME: for backwards compatibility only # FIXME: for backwards compatibility only