From 660b143b457eec4ac368ebf8e1addb0ebd25f473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89loi=20Rivard?= Date: Mon, 14 Nov 2022 18:11:35 +0100 Subject: [PATCH] LDAPObject: fixed a bug in python <-> ldap attributes conversion. This should fix the CI. --- CHANGES.rst | 1 + canaille/ldap_backend/ldapobject.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 96dbd163..01c19def 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -13,6 +13,7 @@ Fixed the LDAP schema update of 0.0.12 - Fixed a bug happening during RP initiated logout on clients without `post_logout_redirect_uri` defined. +- Gitlab CI fix. :pr:`64` Added ***** diff --git a/canaille/ldap_backend/ldapobject.py b/canaille/ldap_backend/ldapobject.py index 1c28531d..6b94d45c 100644 --- a/canaille/ldap_backend/ldapobject.py +++ b/canaille/ldap_backend/ldapobject.py @@ -170,7 +170,10 @@ class LDAPObject: @staticmethod def ldap_to_python(name, value): - syntax = LDAPObject.ldap_object_attributes()[name].syntax + try: + syntax = LDAPObject.ldap_object_attributes()[name].syntax + except KeyError: + return value if syntax == "1.3.6.1.4.1.1466.115.121.1.24": # Generalized Time value = value.decode("utf-8") @@ -189,7 +192,10 @@ class LDAPObject: @staticmethod def python_to_ldap(name, value): - syntax = LDAPObject.ldap_object_attributes()[name].syntax + try: + syntax = LDAPObject.ldap_object_attributes()[name].syntax + except KeyError: + return value if syntax == "1.3.6.1.4.1.1466.115.121.1.24": # Generalized Time return value.strftime("%Y%m%d%H%M%SZ").encode("utf-8")