Make ldap2.add_entry proof to None values, because python-ldap hate'em.

This commit is contained in:
Pavel Zuna 2009-08-28 18:22:32 +02:00 committed by Rob Crittenden
parent 391b1f2b88
commit 356375ef18

View File

@ -314,6 +314,10 @@ class ldap2(CrudBackend, Encoder):
def add_entry(self, dn, entry_attrs):
"""Create a new entry."""
dn = self.normalize_dn(dn)
# remove all None values, python-ldap hates'em
entry_attrs = dict(
(k, v) for (k, v) in entry_attrs.iteritems() if v is not None
)
try:
self.conn.add_s(dn, list(entry_attrs.iteritems()))
except _ldap.LDAPError, e: