summaryrefslogtreecommitdiffstats
path: root/ipaserver/ipaldap.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-01-16 10:24:32 -0500
committerRob Crittenden <rcritten@redhat.com>2009-01-19 10:40:11 -0500
commit785851bf66bc6f044b520c6830aab1ce250fc1c4 (patch)
tree2f58e3730f86e6594449ef7fcf4b765af1bf4efb /ipaserver/ipaldap.py
parent0dd1ba37213dd088a4fd2a48ab478fa263877c1c (diff)
downloadfreeipa-785851bf66bc6f044b520c6830aab1ce250fc1c4.tar.gz
freeipa-785851bf66bc6f044b520c6830aab1ce250fc1c4.tar.xz
freeipa-785851bf66bc6f044b520c6830aab1ce250fc1c4.zip
Add new method, delAttr(), to completely remove an attribute
Fix some errors that weren't being raised properly
Diffstat (limited to 'ipaserver/ipaldap.py')
-rw-r--r--ipaserver/ipaldap.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index 19fd40efd..4a2e4e31c 100644
--- a/ipaserver/ipaldap.py
+++ b/ipaserver/ipaldap.py
@@ -111,6 +111,13 @@ class Entry:
setValues = setValue
+ def delAttr(self, name):
+ """
+ Entirely remove an attribute of this entry.
+ """
+ if self.hasAttr(name):
+ del self.data[name]
+
def toTupleList(self):
"""Convert the attrs and values to a list of 2-tuples. The first element
of the tuple is the attribute name. The second element is either a
@@ -375,7 +382,7 @@ class IPAdmin(SimpleLDAPObject):
except ldap.ALREADY_EXISTS, e:
raise errors.DuplicateEntry, "Entry already exists"
except ldap.LDAPError, e:
- raise DatabaseError, e
+ raise errors.DatabaseError, e
return True
def updateRDN(self, dn, newrdn):
@@ -392,7 +399,7 @@ class IPAdmin(SimpleLDAPObject):
self.set_option(ldap.OPT_SERVER_CONTROLS, sctrl)
self.modrdn_s(dn, newrdn, delold=1)
except ldap.LDAPError, e:
- raise DatabaseError, e
+ raise errors.DatabaseError, e
return True
def updateEntry(self,dn,oldentry,newentry):
@@ -474,7 +481,7 @@ class IPAdmin(SimpleLDAPObject):
self.set_option(ldap.OPT_SERVER_CONTROLS, sctrl)
self.modify_s(dn, modlist)
except ldap.LDAPError, e:
- raise DatabaseError, e
+ raise errors.DatabaseError, e
return True
def deleteEntry(self,*args):