Fix url quoting with non-ascii (closes bug #3256)
authorStavros Sachtouris <saxtouri@admin.grnet.gr>
Tue, 26 Feb 2013 13:22:03 +0000 (15:22 +0200)
committerStavros Sachtouris <saxtouri@admin.grnet.gr>
Tue, 26 Feb 2013 13:22:03 +0000 (15:22 +0200)
kamaki/clients/__init__.py
kamaki/clients/utils.py
version

index 433b023..5ffe57f 100644 (file)
@@ -194,7 +194,7 @@ class Client(object):
             sendlog.info('perform a %s @ %s', method, self.base_url)
 
             self.http_client.url = self.base_url
-            self.http_client.path = quote(path)
+            self.http_client.path = quote(path.encode('utf8'))
             r = self.http_client.perform_request(
                 method,
                 data,
index 5daf23c..e2f2e5a 100644 (file)
@@ -87,19 +87,8 @@ def path4url(*args):
     :returns: (str) a path in the form /args[0]/args[1]/...
     """
 
-    path = ''
-    for arg in args:
-        suffix = '%s' % arg
-        try:
-            while suffix[0] == '/':
-                suffix = '%s' % suffix[1:]
-        except IndexError:
-            continue
-        if len(path) > 0 and path[-1] == '/':
-            path += '%s' % suffix
-        else:
-            path += '/%s' % suffix
-    return path
+    return '/'.join([''] + [arg.decode('utf-8') if (
+        isinstance(arg, str)) else '%s' % arg for arg in args])
 
 
 def params4url(params):
diff --git a/version b/version
index 4b7e8b5..c17c572 100644 (file)
--- a/version
+++ b/version
@@ -1,5 +1 @@
-<<<<<<< HEAD
 0.7next
-=======
-0.7.1
->>>>>>> hotfix-0.7.1