LDAP ORM

Michael Ströder michael at stroeder.com
Mon Oct 22 15:05:07 CEST 2007


James Andrewartha wrote:
> 
> --- cidict.py~  2003-08-25 00:28:12.000000000 +0800
> +++ cidict.py   2007-10-22 20:16:54.000000000 +0800
> @@ -43,6 +43,9 @@
>    def has_key(self,key):
>      return UserDict.has_key(self,lower(key))
> 
> +  def __contains__(self,key):
> +    return UserDict.has_key(self,lower(key))
> +
>    def get(self,key,failobj=None):
>      try:
>        return self[key]

I'd prefer if it's ok for you:

  def __contains__(self,key):
    return self.has_key(self,key)

If you're using ldap.schema you might want to look into using class
ldap.schema.models.Entry instead of simply ldap.cidict.cidict because
you don't have to care about attribute description aliases and mapping
them to OIDs.

Ciao, Michael.



More information about the python-ldap mailing list