[Erp5-report] r42718 jm - /erp5/trunk/products/ERP5Type/Utils.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jan 27 18:43:15 CET 2011


Author: jm
Date: Thu Jan 27 18:43:15 2011
New Revision: 42718

URL: http://svn.erp5.org?rev=42718&view=rev
Log:
urlnormNormaliseUrl: make exception handling consistent

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

Modified:
    erp5/trunk/products/ERP5Type/Utils.py

Modified: erp5/trunk/products/ERP5Type/Utils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Utils.py?rev=42718&r1=42717&r2=42718&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Utils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Utils.py [utf8] Thu Jan 27 18:43:15 2011
@@ -3311,13 +3311,11 @@ def urlnormNormaliseUrl(url, base_url=No
   """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



More information about the Erp5-report mailing list