From c3034ab9ac13a3f6dc239f86598d90d422eff1e2 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 10 Mar 2019 02:07:18 +0100 Subject: [PATCH] consistently using PolicyEngine --- passbook/admin/views/policy.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/passbook/admin/views/policy.py b/passbook/admin/views/policy.py index 51dc4bd0c..355ea916f 100644 --- a/passbook/admin/views/policy.py +++ b/passbook/admin/views/policy.py @@ -11,6 +11,7 @@ from django.views.generic.detail import DetailView from passbook.admin.forms.policies import PolicyTestForm from passbook.admin.mixins import AdminRequiredMixin from passbook.core.models import Policy +from passbook.core.policies import PolicyEngine from passbook.lib.utils.reflection import path_to_class @@ -100,7 +101,9 @@ class PolicyTestView(AdminRequiredMixin, DetailView, FormView): def form_valid(self, form): policy = self.get_object() user = form.cleaned_data.get('user') - result = policy.passes(user) + policy_engine = PolicyEngine([policy]) + policy_engine.for_user(user).with_request(self.request).build() + result = policy_engine.passing if result: messages.success(self.request, _('User successfully passed policy.')) else: