From bc9f5fb39a31e0042f1fa9950b4f9c8a544a0022 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Tue, 3 Jul 2018 00:44:22 +0200 Subject: [PATCH] provisionning: prevent ValueError on a user.roles.clear() (fixes #24949) --- hobo/agent/authentic2/provisionning.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hobo/agent/authentic2/provisionning.py b/hobo/agent/authentic2/provisionning.py index 02fa237..8373cac 100644 --- a/hobo/agent/authentic2/provisionning.py +++ b/hobo/agent/authentic2/provisionning.py @@ -350,7 +350,8 @@ class Provisionning(object): return if sender is self.Role.members.through: self.saved(instance) - for other_instance in model.objects.filter(pk__in=pk_set): + # on a clear, pk_set is None + for other_instance in model.objects.filter(pk__in=pk_set or []): self.saved(other_instance) if action == 'pre_clear': # when the action is pre_clear we need to lookup the current value of the members -- 2.18.0