Merge "Added engine options to disable input/output data conversion"

This commit is contained in:
Jenkins 2017-02-22 17:58:19 +00:00 committed by Gerrit Code Review
commit 2d08340e69
2 changed files with 7 additions and 2 deletions

View File

@ -67,7 +67,9 @@ def _setup_context(data, context, finalizer, convention):
@specs.inject('engine', yaqltypes.Engine())
@specs.name('#finalize')
def finalize(obj, limiter, engine):
return utils.convert_output_data(obj, limiter, engine)
if engine.options.get('yaql.convertOutputData', True):
return utils.convert_output_data(obj, limiter, engine)
return obj
context.register_function(limit)
context.register_function(finalize)

View File

@ -161,7 +161,10 @@ class Statement(Function):
if context is None or context is utils.NO_VALUE:
context = yaql.create_context()
if data is not utils.NO_VALUE:
context['$'] = utils.convert_input_data(data)
if self.engine.options.get('yaql.convertInputData', True):
context['$'] = utils.convert_input_data(data)
else:
context['$'] = data
return self(utils.NO_VALUE, context, self.engine)
def __str__(self):