[PATCH] bug fix: Only redirects POST requests when new resource is created

From: Aline Manera <alinefm@br.ibm.com> generate_action_handler handles the POST requests and it may create a new resource (example, clone template). In this case, the user should be redirected to the new resource to be aware about it. But only in this case. When POST request does not create a new resource it should continue to raise an internal redirection. So verify POST function returns a new ident in order to redirect user to new resource or not. Otherwise, the request: POST /host/reboot will be interpreted as GET /host Signed-off-by: Aline Manera <alinefm@br.ibm.com> --- src/kimchi/control/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/kimchi/control/base.py b/src/kimchi/control/base.py index 5d1f380..eea278e 100644 --- a/src/kimchi/control/base.py +++ b/src/kimchi/control/base.py @@ -74,7 +74,8 @@ class Resource(object): for key in action_args) fn = getattr(self.model, model_fn(self, action_name)) ident = fn(*model_args) - self._redirect(ident) + if ident: + self._redirect(ident) uri_params = [] for arg in self.model_args: if arg is None: -- 1.7.10.4

Please, ignore this patch On 02/25/2014 11:19 PM, Aline Manera wrote:
From: Aline Manera <alinefm@br.ibm.com>
generate_action_handler handles the POST requests and it may create a new resource (example, clone template). In this case, the user should be redirected to the new resource to be aware about it. But only in this case. When POST request does not create a new resource it should continue to raise an internal redirection. So verify POST function returns a new ident in order to redirect user to new resource or not. Otherwise, the request: POST /host/reboot will be interpreted as GET /host
Signed-off-by: Aline Manera <alinefm@br.ibm.com> --- src/kimchi/control/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/control/base.py b/src/kimchi/control/base.py index 5d1f380..eea278e 100644 --- a/src/kimchi/control/base.py +++ b/src/kimchi/control/base.py @@ -74,7 +74,8 @@ class Resource(object): for key in action_args) fn = getattr(self.model, model_fn(self, action_name)) ident = fn(*model_args) - self._redirect(ident) + if ident: + self._redirect(ident) uri_params = [] for arg in self.model_args: if arg is None:
participants (1)
-
Aline Manera