Commit 4306a1e0 authored by Julien Muchembled's avatar Julien Muchembled

urlnormNormaliseUrl: make exception handling consistent

"raise urlnorm.InvalidUrl" was not catched because it was in an except clause.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42718 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4971f922
......@@ -3311,13 +3311,11 @@ def urlnormNormaliseUrl(url, base_url=None):
"""The normalisation up is delegated to urlnorm library.
"""
try:
url = urlnorm.norm(url)
except UnicodeDecodeError:
try:
url = urlnorm.norm(url_unquote(url).decode('latin1'))
url = urlnorm.norm(url)
except UnicodeDecodeError:
raise urlnorm.InvalidUrl
except (AttributeError, urlnorm.InvalidUrl):
url = urlnorm.norm(url_unquote(url).decode('latin1'))
except (AttributeError, UnicodeDecodeError, urlnorm.InvalidUrl):
# This url is not valid, a better Exception will
# be raised
return
......
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