[CMF-checkins] CVS: CMF/CMFDefault - Link.py:1.20
Florent Guillaume
fg@nuxeo.com
Mon, 1 Jul 2002 12:24:21 -0400
Update of /cvs-repository/CMF/CMFDefault
In directory cvs.zope.org:/tmp/cvs-serv12907/CMFDefault
Modified Files:
Link.py
Log Message:
Really, one more commit can't hurt :-)
This now treats mailto: and other schemes correctly.
=== CMF/CMFDefault/Link.py 1.19 => 1.20 ===
"""
tokens = urlparse.urlparse( remote_url, 'http' )
- if tokens[1]:
- # We have a nethost. All is well.
- url = urlparse.urlunparse(tokens)
- elif tokens[2:] == ('', '', '', ''):
- # Empty URL
- url = ''
+ if tokens[0] == 'http':
+ if tokens[1]:
+ # We have a nethost. All is well.
+ url = urlparse.urlunparse(tokens)
+ elif tokens[2:] == ('', '', '', ''):
+ # Empty URL
+ url = ''
+ else:
+ # Relative URL, keep it that way, without http:
+ tokens = ('', '') + tokens[2:]
+ url = urlparse.urlunparse(tokens)
else:
- # Relative URL, keep it that way, without http:
- tokens = ('', '') + tokens[2:]
+ # Other scheme, keep original
url = urlparse.urlunparse(tokens)
self.remote_url = url