Projet

Général

Profil

0021-misc-fixundefined-variable-pylint-error-56982.patch

Valentin Deniaud, 21 septembre 2021 17:09

Télécharger (4,3 ko)

Voir les différences:

Subject: [PATCH 21/59] misc: fixundefined-variable pylint error (#56982)

 .../0017_modify_attribute_serialization.py           |  2 +-
 src/authentic2/plugins.py                            | 12 ++++++------
 src/authentic2/views.py                              |  4 ++--
 tests/settings.py                                    |  4 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)
src/authentic2/migrations/0017_modify_attribute_serialization.py
18 18
    AttributeValue = apps.get_model('authentic2', 'AttributeValue')
19 19
    for atv in AttributeValue.objects.filter(attribute__kind__in=['string', 'title']):
20 20
        b = json.loads(atv.content)
21
        assert isinstance(b, unicode)
21
        assert isinstance(b, str)
22 22
        atv.content = b
23 23
        atv.save()
24 24

  
src/authentic2/plugins.py
125 125
    authentication_backends = list(authentication_backends)
126 126
    for plugin in get_plugins(group_name):
127 127
        if hasattr(plugin, 'get_authentication_backends'):
128
            cls = plugin.get_authentication_backends()
129
            for cls in cls:
128
            classes = plugin.get_authentication_backends()
129
            for cls in classes:
130 130
                if cls not in authentication_backends:
131 131
                    authentication_backends.append(cls)
132 132
    return tuple(authentication_backends)
......
136 136
    authenticators = list(authenticators)
137 137
    for plugin in get_plugins(group_name):
138 138
        if hasattr(plugin, 'get_authenticators'):
139
            cls = plugin.get_authenticators()
140
            for cls in cls:
139
            classes = plugin.get_authenticators()
140
            for cls in classes:
141 141
                if cls not in authenticators:
142 142
                    authenticators.append(cls)
143 143
    return tuple(authenticators)
......
147 147
    idp_backends = list(idp_backends)
148 148
    for plugin in get_plugins(group_name):
149 149
        if hasattr(plugin, 'get_idp_backends'):
150
            cls = plugin.get_idp_backends()
151
            for cls in cls:
150
            classes = plugin.get_idp_backends()
151
            for cls in classes:
152 152
                if cls not in idp_backends:
153 153
                    idp_backends.append(cls)
154 154
    return tuple(idp_backends)
src/authentic2/views.py
794 794
        try:
795 795
            token = models.Token.use('login', token, delete=False)
796 796
        except models.Token.DoesNotExist:
797
            messages.warning(request, _('Login token is unknown or expired'))
797
            messages.warning(self.request, _('Login token is unknown or expired'))
798 798
            return reverse('auth_homepage')
799 799
        except (TypeError, ValueError):
800
            messages.warning(request, _('Login token is invalid'))
800
            messages.warning(self.request, _('Login token is invalid'))
801 801
            return reverse('auth_homepage')
802 802

  
803 803
        uid = token.content['user']
tests/settings.py
52 52

  
53 53
A2_HOOKS_PROPAGATE_EXCEPTIONS = True
54 54

  
55
TEMPLATES[0]['DIRS'].append('tests/templates')
56
TEMPLATES[0]['OPTIONS']['debug'] = True
55
TEMPLATES[0]['DIRS'].append('tests/templates')  # pylint: disable=undefined-variable
56
TEMPLATES[0]['OPTIONS']['debug'] = True  # pylint: disable=undefined-variable
57 57

  
58 58
SITE_BASE_URL = 'http://testserver'
59 59

  
60
-