mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-23 01:57:08 +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)
|
qs = super().resolve_queryset(connection, iterable, info, args)
|
||||||
|
|
||||||
if info.is_awaitable(qs):
|
if info.is_awaitable(qs):
|
||||||
|
|
||||||
async def filter_async(qs):
|
async def filter_async(qs):
|
||||||
filterset = filterset_class(
|
filterset = filterset_class(
|
||||||
data=filter_kwargs(), queryset=await qs, request=info.context
|
data=filter_kwargs(), queryset=await qs, request=info.context
|
||||||
|
@ -102,6 +103,7 @@ class DjangoFilterConnectionField(DjangoConnectionField):
|
||||||
if await sync_to_async(filterset.is_valid)():
|
if await sync_to_async(filterset.is_valid)():
|
||||||
return filterset.qs
|
return filterset.qs
|
||||||
raise ValidationError(filterset.form.errors.as_json())
|
raise ValidationError(filterset.form.errors.as_json())
|
||||||
|
|
||||||
return filter_async(qs)
|
return filter_async(qs)
|
||||||
|
|
||||||
filterset = filterset_class(
|
filterset = filterset_class(
|
||||||
|
|
|
@ -159,12 +159,14 @@ class SerializerMutation(ClientIDMutation):
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
||||||
async def perform_mutate_async():
|
async def perform_mutate_async():
|
||||||
if await sync_to_async(serializer.is_valid)():
|
if await sync_to_async(serializer.is_valid)():
|
||||||
return await sync_to_async(cls.perform_mutate)(serializer, info)
|
return await sync_to_async(cls.perform_mutate)(serializer, info)
|
||||||
else:
|
else:
|
||||||
errors = ErrorType.from_errors(serializer.errors)
|
errors = ErrorType.from_errors(serializer.errors)
|
||||||
return cls(errors=errors)
|
return cls(errors=errors)
|
||||||
|
|
||||||
return perform_mutate_async()
|
return perform_mutate_async()
|
||||||
|
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
|
|
|
@ -290,6 +290,7 @@ class DjangoObjectType(ObjectType):
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
asyncio.get_running_loop()
|
asyncio.get_running_loop()
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user