misc: fix undefined-variable pylint error (#56982)

This commit is contained in:
Valentin Deniaud 2021-09-20 15:48:38 +02:00
parent b49ea2ea0c
commit e2647e6481
4 changed files with 11 additions and 11 deletions

View File

@ -18,7 +18,7 @@ def modify_string_serialization(apps, schema_editor):
AttributeValue = apps.get_model('authentic2', 'AttributeValue')
for atv in AttributeValue.objects.filter(attribute__kind__in=['string', 'title']):
b = json.loads(atv.content)
assert isinstance(b, unicode)
assert isinstance(b, str)
atv.content = b
atv.save()

View File

@ -125,8 +125,8 @@ def register_plugins_authentication_backends(authentication_backends, group_name
authentication_backends = list(authentication_backends)
for plugin in get_plugins(group_name):
if hasattr(plugin, 'get_authentication_backends'):
cls = plugin.get_authentication_backends()
for cls in cls:
classes = plugin.get_authentication_backends()
for cls in classes:
if cls not in authentication_backends:
authentication_backends.append(cls)
return tuple(authentication_backends)
@ -136,8 +136,8 @@ def register_plugins_authenticators(authenticators=(), group_name=DEFAULT_GROUP_
authenticators = list(authenticators)
for plugin in get_plugins(group_name):
if hasattr(plugin, 'get_authenticators'):
cls = plugin.get_authenticators()
for cls in cls:
classes = plugin.get_authenticators()
for cls in classes:
if cls not in authenticators:
authenticators.append(cls)
return tuple(authenticators)
@ -147,8 +147,8 @@ def register_plugins_idp_backends(idp_backends, group_name=DEFAULT_GROUP_NAME):
idp_backends = list(idp_backends)
for plugin in get_plugins(group_name):
if hasattr(plugin, 'get_idp_backends'):
cls = plugin.get_idp_backends()
for cls in cls:
classes = plugin.get_idp_backends()
for cls in classes:
if cls not in idp_backends:
idp_backends.append(cls)
return tuple(idp_backends)

View File

@ -794,10 +794,10 @@ class TokenLoginView(RedirectView):
try:
token = models.Token.use('login', token, delete=False)
except models.Token.DoesNotExist:
messages.warning(request, _('Login token is unknown or expired'))
messages.warning(self.request, _('Login token is unknown or expired'))
return reverse('auth_homepage')
except (TypeError, ValueError):
messages.warning(request, _('Login token is invalid'))
messages.warning(self.request, _('Login token is invalid'))
return reverse('auth_homepage')
uid = token.content['user']

View File

@ -52,8 +52,8 @@ A2_VALIDATE_EMAIL_DOMAIN = False
A2_HOOKS_PROPAGATE_EXCEPTIONS = True
TEMPLATES[0]['DIRS'].append('tests/templates')
TEMPLATES[0]['OPTIONS']['debug'] = True
TEMPLATES[0]['DIRS'].append('tests/templates') # pylint: disable=undefined-variable
TEMPLATES[0]['OPTIONS']['debug'] = True # pylint: disable=undefined-variable
SITE_BASE_URL = 'http://testserver'