[Freeipa-devel] [PATCH] Make ldap2.add_entry proof to None values, because python-ldap hates'em.

Jason Gerard DeRose jderose at redhat.com
Tue Sep 1 05:54:06 UTC 2009


On Mon, 2009-08-31 at 12:03 +0200, Pavel Zuna wrote:
> Rob Crittenden wrote:
> > Pavel Zuna wrote:
> >> python-ldap seems to hate None values when adding an entry and raises 
> >> an exception instead ignoring them, so we need to filter them ourselves.
> >>
> >> Pavel
> > 
> > Couldn't updates contain None as well?
> > 
> > rob
> 
> Updates can and it's valid. None is used in update_entry for deleting attributes.
> 
> Pavel

I thought it was a good idea to normalize all "empty" values to None to
simplify the special cases the Command and Backend plugins have to deal
with.  So empty strings, empty lists, empty dicts, and lists containing
only empty values all get converted to None by Command.__call__() before
Command.run() is called.  If this is a bad idea, I'm open to suggestions
(assuming they don't cause an explosion of special cases).

In create operations, None means the attribute wasn't supplied, and I
think we can just filter them away.  But in update operations, None
means unset the attribute value (if it had one set previously).

So my question is, what value do when set an ldap attribute to when:

  1. unsetting  scalar attribute?
  2. unsetting a multivalue attribute?

Also, do we have to check if the attribute previously had a value before
unsetting?  In other words, will an exception be raised if we unset an
attribute that wasn't set to begin with?








More information about the Freeipa-devel mailing list