From 1695cd24ea557c7d8e8d1313c7181eab67ff0763 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Fri, 5 Jun 2015 00:14:56 +0200 Subject: [PATCH] filter attributs does not necessary exists --- cas_server/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cas_server/models.py b/cas_server/models.py index 0f16a68..35ef411 100644 --- a/cas_server/models.py +++ b/cas_server/models.py @@ -175,8 +175,8 @@ class ServicePattern(models.Model): if self.restrict_users and not self.usernames.filter(value=user.username): raise BadUsername() for filtre in self.filters.all(): - if isinstance(user.attributs[filtre.attribut], list): - attrs = user.attributs[filtre.attribut] + if isinstance(user.attributs.get(filtre.attribut, []), list): + attrs = user.attributs.get(filtre.attribut, []) else: attrs = [user.attributs[filtre.attribut]] for value in attrs: