mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-11 04:07:16 +03:00
Fixed node id fetching when cannot decode. Fixed #14
This commit is contained in:
parent
34d6d07fc3
commit
d2ca8a96a9
|
@ -81,7 +81,10 @@ class NodeField(Field):
|
|||
def id_fetcher(self, global_id, info):
|
||||
from graphene.relay.utils import is_node
|
||||
schema = info.schema.graphene_schema
|
||||
resolved_global_id = from_global_id(global_id)
|
||||
try:
|
||||
resolved_global_id = from_global_id(global_id)
|
||||
except:
|
||||
return None
|
||||
_type, _id = resolved_global_id.type, resolved_global_id.id
|
||||
object_type = schema.get_type(_type)
|
||||
if not is_node(object_type) or (self.field_object_type and
|
||||
|
|
|
@ -38,6 +38,10 @@ def test_nodefield_query():
|
|||
id
|
||||
name
|
||||
},
|
||||
false: myNode(id:"WrongNodeId") {
|
||||
id
|
||||
name
|
||||
},
|
||||
allMyNodes (customArg:"1") {
|
||||
edges {
|
||||
node {
|
||||
|
@ -56,6 +60,7 @@ def test_nodefield_query():
|
|||
'id': 'TXlOb2RlOjE=',
|
||||
'name': 'mo'
|
||||
},
|
||||
'false': None,
|
||||
'allMyNodes': {
|
||||
'edges': [{
|
||||
'node': {
|
||||
|
|
Loading…
Reference in New Issue
Block a user