summaryrefslogtreecommitdiffstats
path: root/ipaserver/ipaldap.py
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-01-10 09:50:22 -0500
committerMartin Kosek <mkosek@redhat.com>2013-03-01 16:59:42 +0100
commit7e1495b404f6d7dd2a8c779736e62f28fc2311ea (patch)
tree54cde6c38e53e7dde1be3eeb56f2688664e5d928 /ipaserver/ipaldap.py
parent83f99070d6a25785e872bbfa8026333fc3110624 (diff)
downloadfreeipa.git-7e1495b404f6d7dd2a8c779736e62f28fc2311ea.tar.gz
freeipa.git-7e1495b404f6d7dd2a8c779736e62f28fc2311ea.tar.xz
freeipa.git-7e1495b404f6d7dd2a8c779736e62f28fc2311ea.zip
Derive Entity class from Entry, and move it to ldapupdate
The two classes were nearly identical, and the updater is the only code that uses Entity. Part of the work for: https://fedorahosted.org/freeipa/ticket/2660
Diffstat (limited to 'ipaserver/ipaldap.py')
-rw-r--r--ipaserver/ipaldap.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index f44c4842..c64cd92b 100644
--- a/ipaserver/ipaldap.py
+++ b/ipaserver/ipaldap.py
@@ -38,7 +38,6 @@ from ipapython import ipautil
from ipalib import errors
from ipapython.ipautil import format_netloc, wait_for_open_socket, wait_for_open_ports
from ipapython.dn import DN
-from ipapython.entity import Entity
from ipaserver.plugins.ldap2 import IPASimpleLDAPObject, LDAPEntry
# Global variable to define SASL auth
@@ -113,6 +112,12 @@ class Entry:
elif isinstance(entrydata, basestring):
self.dn = DN(entrydata)
self.data = ipautil.CIDict()
+ elif isinstance(entrydata, dict):
+ if hasattr(entrydata, 'dn'):
+ entrydata['dn'] = entrydata.dn
+ self.dn = entrydata['dn']
+ del entrydata['dn']
+ self.data = ipautil.CIDict(entrydata)
else:
raise TypeError("entrydata must be 2-tuple, DN, or basestring, got %s" % type(entrydata))
else:
@@ -205,6 +210,7 @@ class Entry:
ldif.LDIFWriter(sio,Entry.base64_attrs,1000).unparse(str(self.dn),newdata)
return sio.getvalue()
+
class IPAdmin(IPAEntryLDAPObject):
def __localinit(self):
@@ -437,8 +443,8 @@ class IPAdmin(IPAEntryLDAPObject):
"""This wraps the add function. It assumes that the entry is already
populated with all of the desired objectclasses and attributes"""
- if not isinstance(entry, (Entry, Entity)):
- raise TypeError('addEntry expected an Entry or Entity object, got %s instead' % entry.__class__)
+ if not isinstance(entry, Entry):
+ raise TypeError('addEntry expected an Entry object, got %s instead' % entry.__class__)
sctrl = self.__get_server_controls()