Package ldaptor :: Module interfaces :: Class ILDAPEntry
[hide private]
[frames] | no frames]

Class ILDAPEntry

source code

zope.interface.Interface --+
                           |
                          ILDAPEntry

Pythonic API for LDAP object access and modification.

>>> o=LDAPEntry(client=ldapclient.LDAPClient(),
...     dn='cn=foo,dc=example,dc=com',
...     attributes={'anAttribute': ['itsValue', 'secondValue'],
...     'onemore': ['aValue'],
...     })
>>> o
LDAPEntry(dn='cn=foo,dc=example,dc=com', attributes={'anAttribute': ['itsValue', 'secondValue'], 'onemore': ['aValue']})
Instance Methods [hide private]
 
__getitem__(self, key)
Get all values of an attribute.
source code
 
get(self, key, default=None)
Get all values of an attribute.
source code
 
has_key(self, key)
TODO
source code
 
__contains__(self, key)
TODO
source code
 
keys(self)
TODO
source code
 
items(self)
TODO
source code
 
__str__(self)
Stringify as LDIF.
source code
 
__eq__(self, other)
Comparison.
source code
 
__ne__(self, other)
Inequality comparison.
source code
 
__len__(self)
TODO
source code
 
__nonzero__(self)
Always return True
source code
 
bind(self, password)
Try to authenticate with given secret.
source code
Class Variables [hide private]
  _InterfaceClass__attrs = {'__contains__': <zope.interface.inte...
  __bases__ = (<InterfaceClass zope.interface.Interface>)
  __identifier__ = 'ldaptor.interfaces.ILDAPEntry'
  __iro__ = (<InterfaceClass ldaptor.interfaces.ILDAPEntry>, <In...
  __name__ = 'ILDAPEntry'
  __sro__ = (<InterfaceClass ldaptor.interfaces.ILDAPEntry>, <In...
  _implied = {<InterfaceClass ldaptor.interfaces.ILDAPEntry>: ()...
  dependents = <WeakKeyDictionary at 1439118668>

Inherited from zope.interface.Interface (private): _Element__tagged_values

Method Details [hide private]

__getitem__(self, key)
(Indexing operator)

source code 

Get all values of an attribute.

>>> o=LDAPEntry(client=ldapclient.LDAPClient(),
...     dn='cn=foo,dc=example,dc=com',
...     attributes={'anAttribute': ['itsValue']})
>>> o['anAttribute']
['itsValue']

get(self, key, default=None)

source code 

Get all values of an attribute.

>>> o=LDAPEntry(client=ldapclient.LDAPClient(),
...     dn='cn=foo,dc=example,dc=com',
...     attributes={'anAttribute': ['itsValue']})
>>> o.get('anAttribute')
['itsValue']
>>> o.get('foo')
>>> o.get('foo', [])
[]

__str__(self)
(Informal representation operator)

source code 

Stringify as LDIF.

>>> o=LDAPEntry(client=ldapclient.LDAPClient(),
...     dn='cn=foo,dc=example,dc=com',
...     attributes={'anAttribute': ['itsValue', 'secondValue'],
...     'onemore': ['aValue'],
...     })
>>> # must use rstrip or doctests won't like it due to the empty line
>>> # you can just say "print o"
>>> print str(o).rstrip()
dn: cn=foo,dc=example,dc=com
anAttribute: itsValue
anAttribute: secondValue
onemore: aValue

__eq__(self, other)
(Equality operator)

source code 

Comparison. Only equality is supported.

>>> client=ldapclient.LDAPClient()
>>> a=LDAPEntry(client=client,
...             dn='dc=example,dc=com')
>>> b=LDAPEntry(client=client,
...             dn='dc=example,dc=com')
>>> a==b
1
>>> c=LDAPEntry(client=ldapclient.LDAPClient(),
...             dn='ou=different,dc=example,dc=com')
>>> a==c
0

Comparison does not consider the client of the object.

>>> anotherClient=ldapclient.LDAPClient()
>>> d=LDAPEntry(client=anotherClient,
...             dn='dc=example,dc=com')
>>> a==d
1

__ne__(self, other)

source code 

Inequality comparison. See __eq__.

bind(self, password)

source code 

Try to authenticate with given secret.

Returns:
Deferred ILDAPEntry (that is, self).
Raises:

Class Variable Details [hide private]

_InterfaceClass__attrs

Value:
{'__contains__': <zope.interface.interface.Method object at 0x55c73e2c\
>,
 '__eq__': <zope.interface.interface.Method object at 0x55c0e80c>,
 '__getitem__': <zope.interface.interface.Method object at 0x55c73dac>\
,
 '__len__': <zope.interface.interface.Method object at 0x55c0e82c>,
 '__ne__': <zope.interface.interface.Method object at 0x55c73cec>,
 '__nonzero__': <zope.interface.interface.Method object at 0x55c73d4c>\
...

__iro__

Value:
(<InterfaceClass ldaptor.interfaces.ILDAPEntry>,
 <InterfaceClass zope.interface.Interface>)

__sro__

Value:
(<InterfaceClass ldaptor.interfaces.ILDAPEntry>,
 <InterfaceClass zope.interface.Interface>)

_implied

Value:
{<InterfaceClass ldaptor.interfaces.ILDAPEntry>: (),
 <InterfaceClass zope.interface.Interface>: ()}