Commit 657490a5 authored by Nicolas Delaby's avatar Nicolas Delaby

InvaliUrl Exception is only available from urlnorm version 1.0.1



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41642 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f5a481fc
...@@ -3254,11 +3254,11 @@ def legacyNormalizeUrl(url, base_url=None): ...@@ -3254,11 +3254,11 @@ def legacyNormalizeUrl(url, base_url=None):
def urlnormNormaliseUrl(url, base_url=None): def urlnormNormaliseUrl(url, base_url=None):
"""The normalisation up is delegated to urlnorm library. """The normalisation up is delegated to urlnorm library.
""" """
InvalidURLException = getattr(urlnorm, 'InvalidUrl', AttributeError)
try: try:
url = urlnorm.norm(url) url = urlnorm.norm(url)
except (AttributeError, urlnorm.InvalidUrl): except InvalidURLException:
# This url is not valid, a better Exception will # This url is not valid
# be raised
return return
url_split = urlparse.urlsplit(url) url_split = urlparse.urlsplit(url)
url_protocol = url_split[0] url_protocol = url_split[0]
......
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