From 4306a1e05062ca263b854fe71d6ce2e4003bfeb5 Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Thu, 27 Jan 2011 17:43:15 +0000 Subject: [PATCH] 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 --- product/ERP5Type/Utils.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/product/ERP5Type/Utils.py b/product/ERP5Type/Utils.py index ff4d1f7b13..c32280da7e 100644 --- a/product/ERP5Type/Utils.py +++ b/product/ERP5Type/Utils.py @@ -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 -- 2.30.9