summaryrefslogtreecommitdiff
path: root/morphlib/remoterepocache.py
diff options
context:
space:
mode:
authorBen Brown <ben.brown@codethink.co.uk>2013-12-10 14:38:20 +0000
committerBen Brown <ben.brown@codethink.co.uk>2013-12-11 17:56:50 +0000
commite22e165e4982053904b3606110d36aa3d757c2a5 (patch)
tree2291342e486b6dd5872cc4c5045bf78c073eca1c /morphlib/remoterepocache.py
parentaa9ae353c5143be9a922e819e0112f63e7034811 (diff)
downloadmorph-e22e165e4982053904b3606110d36aa3d757c2a5.tar.gz
urllib: Convert URLs with non URL friendly characters into a valid format.
Diffstat (limited to 'morphlib/remoterepocache.py')
-rw-r--r--morphlib/remoterepocache.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/morphlib/remoterepocache.py b/morphlib/remoterepocache.py
index ba4937d7..6c7cbd7f 100644
--- a/morphlib/remoterepocache.py
+++ b/morphlib/remoterepocache.py
@@ -19,6 +19,7 @@ import json
import logging
import urllib2
import urlparse
+import urllib
class ResolveRefError(cliapp.AppException):
@@ -51,7 +52,7 @@ class RemoteRepoCache(object):
self._resolver = resolver
def resolve_ref(self, repo_name, ref):
- repo_url = self._resolver.pull_url(repo_name)
+ repo_url = urllib.quote(self._resolver.pull_url(repo_name))
try:
return self._resolve_ref_for_repo_url(repo_url, ref)
except BaseException, e:
@@ -59,7 +60,7 @@ class RemoteRepoCache(object):
raise ResolveRefError(repo_name, ref)
def cat_file(self, repo_name, ref, filename):
- repo_url = self._resolver.pull_url(repo_name)
+ repo_url = urllib.quote(self._resolver.pull_url(repo_name))
try:
return self._cat_file_for_repo_url(repo_url, ref, filename)
except BaseException, e:
@@ -67,7 +68,7 @@ class RemoteRepoCache(object):
raise CatFileError(repo_name, ref, filename)
def ls_tree(self, repo_name, ref):
- repo_url = self._resolver.pull_url(repo_name)
+ repo_url = urllib.quote(self._resolver.pull_url(repo_name))
try:
info = json.loads(self._ls_tree_for_repo_url(repo_url, ref))
return info['tree'].keys()