[Kimchi-devel] [PATCH 1/4] WoK: control/base.py: _generate_action_handler_base changes

Paulo Ricardo Paz Vital pvital at linux.vnet.ibm.com
Tue Nov 17 11:24:28 UTC 2015


Reviewed-By: Paulo Vital <pvital at linux.vnet.ibm.com>

On Mon, 2015-11-16 at 21:04 -0200, dhbarboza82 at gmail.com wrote:
> From: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
> 
> The function _generate_action_handler_base was enforcing
> all parameters passed in the 'action_args' array as if
> they were obligatory, disregarding any setting of the
> API.json of the plug-in.
> 
> This patch makes this process more lenient, adding
> only the parameters that exists in the request. The API.json
> of each plug-in will handle the parameters usage.
> 
> Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
> ---
>  src/wok/control/base.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/wok/control/base.py b/src/wok/control/base.py
> index 638e196..fc42cea 100644
> --- a/src/wok/control/base.py
> +++ b/src/wok/control/base.py
> @@ -109,7 +109,10 @@ class Resource(object):
>                  model_args = list(self.model_args)
>                  if action_args is not None:
>                      request = parse_request()
> -                    model_args.extend(request[key] for key in
> action_args)
> +                    model_args.extend(
> +                        request[key] for key in action_args
> +                        if key in request.keys()
> +                    )
> 
>                  action_fn = getattr(self.model, model_fn(self,
> action_name))
>                  action_result = action_fn(*model_args)




More information about the Kimchi-devel mailing list