Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ldapom/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def __deepcopy__(self, memo):
c._values = copy.deepcopy(self._values)
return c

def is_present(self):
return bool(self._values)


class SingleValueAttributeMixin(object):
single_value = True
Expand Down
12 changes: 12 additions & 0 deletions ldapom/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,15 @@ def can_bind(self, bind_password):
:rtype: boolean
"""
return self._connection.can_bind(self.dn, bind_password)

def has_attribute(self, attribute):
"""Return whether or not this attribute really exists

:param attribute: Name of the attribute
:type attribute: str
:rtype: boolean
"""
attribute = self.get_attribute(attribute)
if attribute is None:
return False
return attribute.is_present()