*: fix linting errors

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-17 20:08:49 +02:00
parent 766c4873a0
commit 32c5bf04b8
8 changed files with 11 additions and 13 deletions

View File

@ -93,7 +93,7 @@ class PropertyMappingViewSet(
"description": subclass.__doc__, "description": subclass.__doc__,
# pyright: reportGeneralTypeIssues=false # pyright: reportGeneralTypeIssues=false
"component": subclass().component, "component": subclass().component,
"model_name": subclass._meta.model_name "model_name": subclass._meta.model_name,
} }
) )
return Response(TypeCreateSerializer(data, many=True).data) return Response(TypeCreateSerializer(data, many=True).data)

View File

@ -78,7 +78,7 @@ class ProviderViewSet(
"name": subclass._meta.verbose_name, "name": subclass._meta.verbose_name,
"description": subclass.__doc__, "description": subclass.__doc__,
"component": subclass().component, "component": subclass().component,
"model_name": subclass._meta.model_name "model_name": subclass._meta.model_name,
} }
) )
data.append( data.append(

View File

@ -81,7 +81,7 @@ class SourceViewSet(
"name": subclass._meta.verbose_name, "name": subclass._meta.verbose_name,
"description": subclass.__doc__, "description": subclass.__doc__,
"component": component, "component": component,
"model_name": subclass._meta.model_name "model_name": subclass._meta.model_name,
} }
) )
return Response(TypeCreateSerializer(data, many=True).data) return Response(TypeCreateSerializer(data, many=True).data)

View File

@ -153,11 +153,6 @@ class EventViewSet(ReadOnlyModelViewSet):
data = [] data = []
for value, name in EventAction.choices: for value, name in EventAction.choices:
data.append( data.append(
{ {"name": name, "description": "", "component": value, "model_name": ""}
"name": name,
"description": "",
"component": value,
"model_name": ""
}
) )
return Response(TypeCreateSerializer(data, many=True).data) return Response(TypeCreateSerializer(data, many=True).data)

View File

@ -80,7 +80,7 @@ class StageViewSet(
"name": subclass._meta.verbose_name, "name": subclass._meta.verbose_name,
"description": subclass.__doc__, "description": subclass.__doc__,
"component": subclass().component, "component": subclass().component,
"model_name": subclass._meta.model_name "model_name": subclass._meta.model_name,
} }
) )
data = sorted(data, key=lambda x: x["name"]) data = sorted(data, key=lambda x: x["name"])

View File

@ -82,7 +82,7 @@ class ServiceConnectionViewSet(
"name": subclass._meta.verbose_name, "name": subclass._meta.verbose_name,
"description": subclass.__doc__, "description": subclass.__doc__,
"component": subclass().component, "component": subclass().component,
"model_name": subclass._meta.model_name "model_name": subclass._meta.model_name,
} }
) )
return Response(TypeCreateSerializer(data, many=True).data) return Response(TypeCreateSerializer(data, many=True).data)

View File

@ -108,7 +108,7 @@ class PolicyViewSet(
"name": subclass._meta.verbose_name, "name": subclass._meta.verbose_name,
"description": subclass.__doc__, "description": subclass.__doc__,
"component": subclass().component, "component": subclass().component,
"model_name": subclass._meta.model_name "model_name": subclass._meta.model_name,
} }
) )
return Response(TypeCreateSerializer(data, many=True).data) return Response(TypeCreateSerializer(data, many=True).data)

View File

@ -6,7 +6,7 @@ from urllib.parse import parse_qs, urlencode, urlsplit, urlunsplit
from uuid import uuid4 from uuid import uuid4
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from django.http.response import Http404, HttpResponseRedirect from django.http.response import Http404, HttpResponseBadRequest, HttpResponseRedirect
from django.shortcuts import get_object_or_404, redirect from django.shortcuts import get_object_or_404, redirect
from django.utils import timezone from django.utils import timezone
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
@ -236,6 +236,9 @@ class OAuthFulfillmentStage(StageView):
# pylint: disable=unused-argument # pylint: disable=unused-argument
def get(self, request: HttpRequest, *args, **kwargs) -> HttpResponse: def get(self, request: HttpRequest, *args, **kwargs) -> HttpResponse:
"""final Stage of an OAuth2 Flow""" """final Stage of an OAuth2 Flow"""
if PLAN_CONTEXT_PARAMS not in self.executor.plan.context:
LOGGER.warning("Got to fulfillment stage with no pending context")
return HttpResponseBadRequest()
self.params: OAuthAuthorizationParams = self.executor.plan.context.pop( self.params: OAuthAuthorizationParams = self.executor.plan.context.pop(
PLAN_CONTEXT_PARAMS PLAN_CONTEXT_PARAMS
) )