From 9b94c14f67fd9a1ce702f3a7f0f21ffed204c0ff Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Thu, 14 Feb 2019 11:26:14 +0100 Subject: [PATCH 2/6] backends: PEP8ness, style (#30252) --- src/authentic2/backends/models_backend.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/authentic2/backends/models_backend.py b/src/authentic2/backends/models_backend.py index 335b29c4..1995e59c 100644 --- a/src/authentic2/backends/models_backend.py +++ b/src/authentic2/backends/models_backend.py @@ -1,8 +1,25 @@ +# +# Copyright (C) 2010-2019 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + from __future__ import unicode_literals from django.db import models from django.contrib.auth import get_user_model from django.contrib.auth.backends import ModelBackend +from django.utils import six from .. import app_settings from authentic2.user_login_failure import user_login_success, user_login_failure @@ -39,10 +56,10 @@ class ModelBackend(ModelBackend): if app_settings.REALMS: for realm, desc in app_settings.REALMS: queries.append(models.Q( - **{username_field: upn(username, realm)})) + **{username_field: upn(username, realm)})) else: queries.append(models.Q(**{username_field: upn(username, realm)})) - return reduce(models.Q.__or__, queries) + return six.moves.reduce(models.Q.__or__, queries) def must_reset_password(self, user): from .. import models -- 2.20.1