Make scalar get_type an instance method.

Given the current way of how Scalars are mostly being created in the schema, e.g. `graphene.Boolean(description='Some boolean')` and then how they get 'magically' turned into a `Field` using `self.get_type()` it makes sense to make this an Instance method rather than a classmethod. This allows e.g. to set attributes on the instance that will always be accessible, as they are being returned by `get_type`.
This commit is contained in:
Markus Padourek 2016-10-21 09:34:06 +01:00 committed by GitHub
parent 0a80119f5e
commit d3305f6056

View File

@ -41,9 +41,8 @@ class Scalar(six.with_metaclass(ScalarTypeMeta, UnmountedType)):
parse_value = None parse_value = None
parse_literal = None parse_literal = None
@classmethod def get_type(self):
def get_type(cls): return self
return cls
# As per the GraphQL Spec, Integers are only treated as valid when a valid # As per the GraphQL Spec, Integers are only treated as valid when a valid
# 32-bit signed integer, providing the broadest support across platforms. # 32-bit signed integer, providing the broadest support across platforms.