[Kimchi-devel] [PATCH V3 17/34] Use InternalRedirect for all plugin redirects

Lucio Correia luciojhc at linux.vnet.ibm.com
Wed Jul 8 19:17:49 UTC 2015


The attribute self.uri_fmt is used both with HTTPRedirect and
InternalRedirect calls. In the new plugin structure, it is
necessary to make all redirects uniform, since InternalRedirect
is relative to current path (i.e. /plugins/kimchi) and
HTTPRedirect is not. This patch converts all plugin redirects
to use InternalRedirect, since it is less costly.

Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
Signed-off-by: Gustavo Y. Ribeiro <gyr at linux.vnet.ibm.com>
---
 src/wok/control/base.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/wok/control/base.py b/src/wok/control/base.py
index 8cfa51c..65a6fee 100644
--- a/src/wok/control/base.py
+++ b/src/wok/control/base.py
@@ -64,12 +64,12 @@ class Resource(object):
                 if arg is None:
                     arg = ''
                 uri_params.append(urllib2.quote(arg.encode('utf-8'), safe=""))
-            raise cherrypy.HTTPRedirect(self.uri_fmt % tuple(uri_params), code)
+            raise internal_redirect(self.uri_fmt % tuple(uri_params))
         elif action_result is not None and action_result != self.ident:
             uri_params = list(self.model_args[:-1])
             uri_params += [urllib2.quote(action_result.encode('utf-8'),
                            safe="")]
-            raise cherrypy.HTTPRedirect(self.uri_fmt % tuple(uri_params), code)
+            raise internal_redirect(self.uri_fmt % tuple(uri_params))
 
     def generate_action_handler(self, action_name, action_args=None,
                                 destructive=False):
-- 
1.7.1




More information about the Kimchi-devel mailing list