2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/98962174b0b1/ Changeset: 98962174b0b1 User: jmchilton Date: 2013-11-19 20:07:50 Summary: Allow implicit use of tool default parameter values when using API. Affected #: 1 file diff -r f2186f4796ad4c6aa2c9191f9804d8f5d59eb15d -r 98962174b0b12e239eff913353d683e396d2b004 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2015,12 +2015,15 @@ test_param_key = prefix + input.test_param.name else: test_param_key = group_prefix + input.test_param.name - test_param_error = None - test_incoming = get_incoming_value( incoming, test_param_key, None ) + # Get value of test param and determine current case + value, test_param_error = check_param_from_incoming( trans, + group_state, + input.test_param, + incoming, + test_param_key, + context, + source ) - # Get value of test param and determine current case - value, test_param_error = \ - check_param( trans, input.test_param, test_incoming, context, source=source ) current_case = input.get_current_case( value, trans ) # Current case has changed, throw away old state group_state = state[input.name] = {} @@ -2083,8 +2086,7 @@ if any_group_errors: errors[input.name] = group_errors else: - incoming_value = get_incoming_value( incoming, key, None ) - value, error = check_param( trans, input, incoming_value, context, source=source ) + value, error = check_param_from_incoming( trans, state, input, incoming, key, context, source ) if error: errors[ input.name ] = error state[ input.name ] = value @@ -3481,7 +3483,24 @@ else: return val + +def check_param_from_incoming( trans, state, input, incoming, key, context, source ): + """ + Unlike "update" state, this preserves default if no incoming value found. + This lets API user specify just a subset of params and allow defaults to be + used when available. + """ + default_input_value = state.get( input.name, None ) + incoming_value = get_incoming_value( incoming, key, default_input_value ) + value, error = check_param( trans, input, incoming_value, context, source=source ) + return value, error + + def get_incoming_value( incoming, key, default ): + """ + Fetch value from incoming dict directly or check special nginx upload + created variants of this key. + """ if "__" + key + "__is_composite" in incoming: composite_keys = incoming["__" + key + "__keys"].split() value = dict() https://bitbucket.org/galaxy/galaxy-central/commits/ef45d85b1f57/ Changeset: ef45d85b1f57 User: jmchilton Date: 2013-11-20 23:37:49 Summary: Merged in jmchilton/galaxy-central-fork-1 (pull request #265) Allow implicit use of tool default parameter values when using API. Affected #: 1 file diff -r e507124fbe79903378c4b0fe150f2f3fd816ad32 -r ef45d85b1f579c5bb4b07284dd96ad8403003c03 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2015,12 +2015,15 @@ test_param_key = prefix + input.test_param.name else: test_param_key = group_prefix + input.test_param.name - test_param_error = None - test_incoming = get_incoming_value( incoming, test_param_key, None ) + # Get value of test param and determine current case + value, test_param_error = check_param_from_incoming( trans, + group_state, + input.test_param, + incoming, + test_param_key, + context, + source ) - # Get value of test param and determine current case - value, test_param_error = \ - check_param( trans, input.test_param, test_incoming, context, source=source ) current_case = input.get_current_case( value, trans ) # Current case has changed, throw away old state group_state = state[input.name] = {} @@ -2083,8 +2086,7 @@ if any_group_errors: errors[input.name] = group_errors else: - incoming_value = get_incoming_value( incoming, key, None ) - value, error = check_param( trans, input, incoming_value, context, source=source ) + value, error = check_param_from_incoming( trans, state, input, incoming, key, context, source ) if error: errors[ input.name ] = error state[ input.name ] = value @@ -3481,7 +3483,24 @@ else: return val + +def check_param_from_incoming( trans, state, input, incoming, key, context, source ): + """ + Unlike "update" state, this preserves default if no incoming value found. + This lets API user specify just a subset of params and allow defaults to be + used when available. + """ + default_input_value = state.get( input.name, None ) + incoming_value = get_incoming_value( incoming, key, default_input_value ) + value, error = check_param( trans, input, incoming_value, context, source=source ) + return value, error + + def get_incoming_value( incoming, key, default ): + """ + Fetch value from incoming dict directly or check special nginx upload + created variants of this key. + """ if "__" + key + "__is_composite" in incoming: composite_keys = incoming["__" + key + "__keys"].split() value = dict() Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.