@@ -18,10 +18,10 @@ class ExecutionContext(object):
18
18
Namely, schema of the type system that is currently executing,
19
19
and the fragments defined in the query document"""
20
20
21
- __slots__ = 'schema' , 'fragments' , 'root ' , 'operation' , 'variables ' , 'errors' , 'request_context ' , \
21
+ __slots__ = 'schema' , 'fragments' , 'root_value ' , 'operation' , 'variable_values ' , 'errors' , 'context_value ' , \
22
22
'argument_values_cache'
23
23
24
- def __init__ (self , schema , root , document_ast , operation_name , args , request_context ):
24
+ def __init__ (self , schema , document_ast , root_value , context_value , variable_values , operation_name ):
25
25
"""Constructs a ExecutionContext object from the arguments passed
26
26
to execute, which we will pass throughout the other execution
27
27
methods."""
@@ -53,15 +53,15 @@ def __init__(self, schema, root, document_ast, operation_name, args, request_con
53
53
else :
54
54
raise GraphQLError ('Must provide an operation.' )
55
55
56
- variables = get_variable_values (schema , operation .variable_definitions or [], args )
56
+ variable_values = get_variable_values (schema , operation .variable_definitions or [], variable_values )
57
57
58
58
self .schema = schema
59
59
self .fragments = fragments
60
- self .root = root
60
+ self .root_value = root_value
61
61
self .operation = operation
62
- self .variables = variables
62
+ self .variable_values = variable_values
63
63
self .errors = errors
64
- self .request_context = request_context
64
+ self .context_value = context_value
65
65
self .argument_values_cache = {}
66
66
67
67
def get_argument_values (self , field_def , field_ast ):
@@ -70,7 +70,7 @@ def get_argument_values(self, field_def, field_ast):
70
70
71
71
if not result :
72
72
result = self .argument_values_cache [k ] = get_argument_values (field_def .args , field_ast .arguments ,
73
- self .variables )
73
+ self .variable_values )
74
74
75
75
return result
76
76
@@ -190,6 +190,7 @@ def collect_fields(ctx, runtime_type, selection_set, fields, prev_fragment_names
190
190
def should_include_node (ctx , directives ):
191
191
"""Determines if a field should be included based on the @include and
192
192
@skip directives, where @skip has higher precidence than @include."""
193
+ # TODO: Refactor based on latest code
193
194
if directives :
194
195
skip_ast = None
195
196
@@ -202,7 +203,7 @@ def should_include_node(ctx, directives):
202
203
args = get_argument_values (
203
204
GraphQLSkipDirective .args ,
204
205
skip_ast .arguments ,
205
- ctx .variables ,
206
+ ctx .variable_values ,
206
207
)
207
208
return not args .get ('if' )
208
209
@@ -217,7 +218,7 @@ def should_include_node(ctx, directives):
217
218
args = get_argument_values (
218
219
GraphQLIncludeDirective .args ,
219
220
include_ast .arguments ,
220
- ctx .variables ,
221
+ ctx .variable_values ,
221
222
)
222
223
223
224
return bool (args .get ('if' ))
@@ -249,36 +250,16 @@ def get_field_entry_key(node):
249
250
250
251
class ResolveInfo (object ):
251
252
252
- def __init__ (self , field_name , field_asts , return_type , parent_type , context ):
253
+ def __init__ (self , field_name , field_asts , return_type , parent_type , schema , fragments , root_value , operation , variable_values ):
253
254
self .field_name = field_name
254
255
self .field_asts = field_asts
255
256
self .return_type = return_type
256
257
self .parent_type = parent_type
257
- self .context = context
258
-
259
- @property
260
- def schema (self ):
261
- return self .context .schema
262
-
263
- @property
264
- def fragments (self ):
265
- return self .context .fragments
266
-
267
- @property
268
- def root_value (self ):
269
- return self .context .root
270
-
271
- @property
272
- def operation (self ):
273
- return self .context .operation
274
-
275
- @property
276
- def variable_values (self ):
277
- return self .context .variables
278
-
279
- @property
280
- def request_context (self ):
281
- return self .context .request_context
258
+ self .schema = schema
259
+ self .fragments = fragments
260
+ self .root_value = root_value
261
+ self .operation = operation
262
+ self .variable_values = variable_values
282
263
283
264
284
265
def default_resolve_fn (source , args , info ):
0 commit comments