Skip to content

Commit 807ae70

Browse files
Fix(register): updated register_enum function support custom classes (#217)
Use isinstance instead of type to support instances of enum class in addition to exact same type. Co-authored-by: u243606 <adithyan@strollby.com>
1 parent 0fd99c9 commit 807ae70

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

graphene_mongo/registry.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ def register(self, cls):
2626

2727
def register_enum(self, cls):
2828
from enum import EnumMeta
29-
assert type(cls) == EnumMeta, 'Only EnumMeta can be registered, received "{}"'.format(
30-
cls.__name__
31-
)
29+
assert isinstance(
30+
cls, EnumMeta
31+
), f'Only EnumMeta can be registered, received "{cls.__name__}"'
3232
if not cls.__name__.endswith('Enum'):
3333
name = cls.__name__ + 'Enum'
3434
else:

0 commit comments

Comments
 (0)