Avoid unhandled exceptions

This commit is contained in:
sfigato 2022-02-01 23:30:26 +01:00
parent b704ea4d10
commit 297b31ab90
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F

View File

@ -95,7 +95,11 @@ class Entry(object):
async def describe(self):
_internal = await self._get()
values = dict((k, de_listify(_internal[k])) for k in self.ldap_attributes)
values = dict()
for attr in self.ldap_attributes:
value = _internal.get(attr)
if value:
values[attr] = de_listify(value)
if "userPassword" in self.ldap_attributes:
values.pop("userPassword")
values["dn"] = self.dn