mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-22 17:47:12 +03:00
linting
This commit is contained in:
parent
c501fdb20b
commit
58b92e6ed3
|
@ -95,6 +95,7 @@ class DjangoFilterConnectionField(DjangoConnectionField):
|
|||
qs = super().resolve_queryset(connection, iterable, info, args)
|
||||
|
||||
if info.is_awaitable(qs):
|
||||
|
||||
async def filter_async(qs):
|
||||
filterset = filterset_class(
|
||||
data=filter_kwargs(), queryset=await qs, request=info.context
|
||||
|
@ -102,6 +103,7 @@ class DjangoFilterConnectionField(DjangoConnectionField):
|
|||
if await sync_to_async(filterset.is_valid)():
|
||||
return filterset.qs
|
||||
raise ValidationError(filterset.form.errors.as_json())
|
||||
|
||||
return filter_async(qs)
|
||||
|
||||
filterset = filterset_class(
|
||||
|
|
|
@ -154,17 +154,19 @@ class SerializerMutation(ClientIDMutation):
|
|||
kwargs = cls.get_serializer_kwargs(root, info, **input)
|
||||
serializer = cls._meta.serializer_class(**kwargs)
|
||||
|
||||
try:
|
||||
try:
|
||||
get_running_loop()
|
||||
except RuntimeError:
|
||||
pass
|
||||
pass
|
||||
else:
|
||||
|
||||
async def perform_mutate_async():
|
||||
if await sync_to_async(serializer.is_valid)():
|
||||
return await sync_to_async(cls.perform_mutate)(serializer, info)
|
||||
else:
|
||||
errors = ErrorType.from_errors(serializer.errors)
|
||||
return cls(errors=errors)
|
||||
|
||||
return perform_mutate_async()
|
||||
|
||||
if serializer.is_valid():
|
||||
|
|
|
@ -288,14 +288,15 @@ class DjangoObjectType(ObjectType):
|
|||
def get_node(cls, info, id):
|
||||
queryset = cls.get_queryset(cls._meta.model.objects, info)
|
||||
try:
|
||||
try:
|
||||
try:
|
||||
import asyncio
|
||||
|
||||
asyncio.get_running_loop()
|
||||
except RuntimeError:
|
||||
pass
|
||||
else:
|
||||
return queryset.aget(pk=id)
|
||||
|
||||
|
||||
return queryset.get(pk=id)
|
||||
except cls._meta.model.DoesNotExist:
|
||||
return None
|
||||
|
|
Loading…
Reference in New Issue
Block a user