From 297b31ab9098faeadc97ba4716d93e865461d4ee Mon Sep 17 00:00:00 2001 From: Blallo Date: Tue, 1 Feb 2022 23:30:26 +0100 Subject: [PATCH] Avoid unhandled exceptions --- src/phi/async_ldap/mixins.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/phi/async_ldap/mixins.py b/src/phi/async_ldap/mixins.py index 1aff860..12b313e 100644 --- a/src/phi/async_ldap/mixins.py +++ b/src/phi/async_ldap/mixins.py @@ -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