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

dhbarboza82 at gmail.com dhbarboza82 at gmail.com
Mon Nov 16 23:04:44 UTC 2015


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)
-- 
2.4.3




More information about the Kimchi-devel mailing list