diff --git a/canaille/app/configuration.py b/canaille/app/configuration.py index 556edef4..01d6bde1 100644 --- a/canaille/app/configuration.py +++ b/canaille/app/configuration.py @@ -132,8 +132,10 @@ def toml_content(file_path): with open(file_path, "rb") as fd: return tomllib.load(fd) - except ImportError: - raise Exception("toml library not installed. Cannot load configuration.") + except ImportError as exc: + raise Exception( + "toml library not installed. Cannot load configuration." + ) from exc def setup_config(app, config=None, test_config=True, env_file=".env", env_prefix=""): diff --git a/canaille/backends/ldap/backend.py b/canaille/backends/ldap/backend.py index 2d39b770..d96262cd 100644 --- a/canaille/backends/ldap/backend.py +++ b/canaille/backends/ldap/backend.py @@ -264,7 +264,7 @@ class LDAPBackend(Backend): class_filter = ( "".join([f"(objectClass={oc})" for oc in model.ldap_object_class]) - if getattr(model, "ldap_object_class") + if model.ldap_object_class else "" ) if class_filter: diff --git a/pyproject.toml b/pyproject.toml index 58f47616..4186c737 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -170,6 +170,7 @@ exclude_lines = [ [tool.ruff.lint] select = [ + "B", # flake8-bugbear "E", # pycodestyle "F", # pyflakes "I", # isort