Commit 4f9101c1 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Made asURL method more robust.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13634 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 94c2cab6
......@@ -51,7 +51,8 @@ class UrlMixIn:
'asURL')
def asURL(self):
"""
Returns a text representation of the Url
Returns a text representation of the Url if defined
or None else.
"""
protocol = self.getUrlProtocol()
if not protocol:
......@@ -63,6 +64,7 @@ class UrlMixIn:
else:
protocol = 'http'
url_string = self.getUrlString()
if not url_string: return None
if protocol in no_host_protocol_list or url_string.startswith('//'):
return '%s:%s' % (protocol, url_string)
return '%s://%s' % (protocol, url_string)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment