[CMF-checkins] CVS: CMF/CMFDefault - Link.py:1.19
Florent Guillaume
fg@nuxeo.com
Mon, 1 Jul 2002 09:57:17 -0400
Update of /cvs-repository/CMF/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv14710/CMFDefault
Modified Files:
Link.py
Log Message:
This time I hope relative URLs are handled correctly.
=== CMF/CMFDefault/Link.py 1.18 => 1.19 ===
# We have a nethost. All is well.
url = urlparse.urlunparse(tokens)
- elif remote_url[:1] == '/':
- # Starts with a slash, site-relative URL,
- # no way to completely absolutize it.
- url = urlparse.urlunparse(tokens)
+ elif tokens[2:] == ('', '', '', ''):
+ # Empty URL
+ url = ''
else:
- # Starts with a host without http:// qualification,
- # add it correctly because urlparse didn't do it.
- tokens = urlparse.urlparse('http://'+remote_url)
+ # Relative URL, keep it that way, without http:
+ tokens = ('', '') + tokens[2:]
url = urlparse.urlunparse(tokens)
- if url == 'http:':
- url = ''
self.remote_url = url
security.declareProtected( CMFCorePermissions.ModifyPortalContent, 'edit' )