mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-27 08:19:45 +03:00
Add isinstance check for Enum in default resolver
This commit is contained in:
parent
2cc701f444
commit
d58126facb
|
@ -1,5 +1,11 @@
|
||||||
|
from .enum import PyEnum
|
||||||
|
|
||||||
|
|
||||||
def attr_resolver(attname, default_value, root, info, **args):
|
def attr_resolver(attname, default_value, root, info, **args):
|
||||||
return getattr(root, attname, default_value)
|
value = getattr(root, attname, default_value)
|
||||||
|
if isinstance(value, PyEnum):
|
||||||
|
return value.value
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
def dict_resolver(attname, default_value, root, info, **args):
|
def dict_resolver(attname, default_value, root, info, **args):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user