From d0cfee56417b3346e141978ad74a33087ddb4e5a Mon Sep 17 00:00:00 2001 From: Eran Kampf <205185+ekampf@users.noreply.github.com> Date: Mon, 8 Apr 2019 14:06:32 -0700 Subject: [PATCH] Make UUID compatible (Fixed issue #936) (#937) * Make UUID compatible * Fix typo * black code formatting --- graphene/types/uuid.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/graphene/types/uuid.py b/graphene/types/uuid.py index abb8f110..b9687e1e 100644 --- a/graphene/types/uuid.py +++ b/graphene/types/uuid.py @@ -1,5 +1,5 @@ from __future__ import absolute_import - +import six from uuid import UUID as _UUID from graphql.language import ast @@ -12,8 +12,9 @@ class UUID(Scalar): @staticmethod def serialize(uuid): - if isinstance(uuid, str): + if isinstance(uuid, six.string_types): uuid = _UUID(uuid) + assert isinstance(uuid, _UUID), "Expected UUID instance, received {}".format( uuid )