summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-02-20 14:05:25 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-02-20 14:05:25 +0000
commitc7bd647c9c934e1c5082ed841d07cef3af4dfe30 (patch)
treef85ba7d701e5e212e4880275fa795e13f8bef11e /morphlib
parent15bdb1607613fb393b63712ea8eb856a5bf4b81f (diff)
downloadmorph-c7bd647c9c934e1c5082ed841d07cef3af4dfe30.tar.gz
Update quote_url() to replace : with _.
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/sourcemanager.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/morphlib/sourcemanager.py b/morphlib/sourcemanager.py
index 11d891de..926f1d0d 100644
--- a/morphlib/sourcemanager.py
+++ b/morphlib/sourcemanager.py
@@ -30,11 +30,17 @@ urlparse.uses_params.extend(gitscheme)
urlparse.uses_query.extend(gitscheme)
urlparse.uses_fragment.extend(gitscheme)
-_valid_chars = string.digits + string.letters + ':%_'
-
def quote_url(url):
- transl = lambda x: x if x in _valid_chars else '_'
+ ''' Convert URIs to strings that only contain digits, letters, % and _.
+
+ NOTE: When changing the code of this function, make sure to also apply
+ the same to the quote_url() function of lorry. Otherwise the git bundles
+ generated by lorry may no longer be found by morph.
+
+ '''
+ valid_chars = string.digits + string.letters + '%_'
+ transl = lambda x: x if x in valid_chars else '_'
return ''.join([transl(x) for x in url])
@@ -81,7 +87,6 @@ class SourceManager(object):
t = urlparse.urlparse(url)
path = t[2]
basename = os.path.basename(path)
- basename = '_'.join(basename.split(':'))
saved_name = os.path.join(self.cache_dir, basename)
source_handle = urllib2.urlopen(url)