| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,9 +56,11 @@ def __init__(self, **kwargs): | |||
| 56 | 56 | if hasattr(self, key): | |
| 57 | 57 | setattr(self, key, value) | |
| 58 | 58 | ||
| 59 | - assert isinstance( | ||
| 60 | - self.schema, GraphQLSchema | ||
| 61 | - ), "A Schema is required to be provided to GraphQLView." | ||
| 59 | + if not isinstance(self.schema, GraphQLSchema): | ||
| 60 | + # maybe the GraphQL schema is wrapped in a Graphene schema | ||
| 61 | + self.schema = getattr(self.schema, "graphql_schema", None) | ||
| 62 | + if not isinstance(self.schema, GraphQLSchema): | ||
| 63 | + raise TypeError("A Schema is required to be provided to GraphQLView.") | ||
| 62 | 64 | ||
| 63 | 65 | def get_root_value(self): | |
| 64 | 66 | return self.root_value | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,9 +55,11 @@ def __init__(self, **kwargs): | |||
| 55 | 55 | if hasattr(self, key): | |
| 56 | 56 | setattr(self, key, value) | |
| 57 | 57 | ||
| 58 | - assert isinstance( | ||
| 59 | - self.schema, GraphQLSchema | ||
| 60 | - ), "A Schema is required to be provided to GraphQLView." | ||
| 58 | + if not isinstance(self.schema, GraphQLSchema): | ||
| 59 | + # maybe the GraphQL schema is wrapped in a Graphene schema | ||
| 60 | + self.schema = getattr(self.schema, "graphql_schema", None) | ||
| 61 | + if not isinstance(self.schema, GraphQLSchema): | ||
| 62 | + raise TypeError("A Schema is required to be provided to GraphQLView.") | ||
| 61 | 63 | ||
| 62 | 64 | def get_root_value(self): | |
| 63 | 65 | return self.root_value | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,9 +57,11 @@ def __init__(self, **kwargs): | |||
| 57 | 57 | if hasattr(self, key): | |
| 58 | 58 | setattr(self, key, value) | |
| 59 | 59 | ||
| 60 | - assert isinstance( | ||
| 61 | - self.schema, GraphQLSchema | ||
| 62 | - ), "A Schema is required to be provided to GraphQLView." | ||
| 60 | + if not isinstance(self.schema, GraphQLSchema): | ||
| 61 | + # maybe the GraphQL schema is wrapped in a Graphene schema | ||
| 62 | + self.schema = getattr(self.schema, "graphql_schema", None) | ||
| 63 | + if not isinstance(self.schema, GraphQLSchema): | ||
| 64 | + raise TypeError("A Schema is required to be provided to GraphQLView.") | ||
| 63 | 65 | ||
| 64 | 66 | def get_root_value(self): | |
| 65 | 67 | return self.root_value | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,9 +58,11 @@ def __init__(self, **kwargs): | |||
| 58 | 58 | if hasattr(self, key): | |
| 59 | 59 | setattr(self, key, value) | |
| 60 | 60 | ||
| 61 | - assert isinstance( | ||
| 62 | - self.schema, GraphQLSchema | ||
| 63 | - ), "A Schema is required to be provided to GraphQLView." | ||
| 61 | + if not isinstance(self.schema, GraphQLSchema): | ||
| 62 | + # maybe the GraphQL schema is wrapped in a Graphene schema | ||
| 63 | + self.schema = getattr(self.schema, "graphql_schema", None) | ||
| 64 | + if not isinstance(self.schema, GraphQLSchema): | ||
| 65 | + raise TypeError("A Schema is required to be provided to GraphQLView.") | ||
| 64 | 66 | ||
| 65 | 67 | def get_root_value(self): | |
| 66 | 68 | return self.root_value | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,9 +55,11 @@ def __init__(self, **kwargs): | |||
| 55 | 55 | if hasattr(self, key): | |
| 56 | 56 | setattr(self, key, value) | |
| 57 | 57 | ||
| 58 | - assert isinstance( | ||
| 59 | - self.schema, GraphQLSchema | ||
| 60 | - ), "A Schema is required to be provided to GraphQLView." | ||
| 58 | + if not isinstance(self.schema, GraphQLSchema): | ||
| 59 | + # maybe the GraphQL schema is wrapped in a Graphene schema | ||
| 60 | + self.schema = getattr(self.schema, "graphql_schema", None) | ||
| 61 | + if not isinstance(self.schema, GraphQLSchema): | ||
| 62 | + raise TypeError("A Schema is required to be provided to GraphQLView.") | ||
| 61 | 63 | ||
| 62 | 64 | def get_root_value(self): | |
| 63 | 65 | return self.root_value | |
| Back | FazBrowse Home | New Git URL |
0 commit comments