[Kimchi-devel] [PATCH] Issue #315: edit/delete templates that contains slashes in their names

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Fri Feb 21 15:23:47 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

we should unquote the resource name when it contains special characters.

issue:
https://github.com/kimchi-project/kimchi/issues/315

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.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 e8f03ae..048dd34 100644
--- a/src/kimchi/control/base.py
+++ b/src/kimchi/control/base.py
@@ -54,6 +54,7 @@ class Resource(object):
     """
     def __init__(self, model, ident=None):
         self.model = model
+        ident = ident if ident is None else urllib2.unquote(ident)
         self.ident = ident
         self.model_args = (ident,)
         self.update_params = []
@@ -61,7 +62,7 @@ class Resource(object):
     def _redirect(self, ident, code=303):
         if ident is not None and ident != self.ident:
             uri_params = list(self.model_args[:-1])
-            uri_params += [urllib2.quote(ident.encode('utf-8'))]
+            uri_params += [urllib2.quote(ident.encode('utf-8'), safe="")]
             raise cherrypy.HTTPRedirect(self.uri_fmt % tuple(uri_params), code)
 
     def generate_action_handler(self, action_name, action_args=None):
-- 
1.8.4.2




More information about the Kimchi-devel mailing list