[Erp5-report] r42027 nicolas - /erp5/trunk/products/ERP5Type/Utils.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jan 5 14:35:17 CET 2011


Author: nicolas
Date: Wed Jan  5 14:35:16 2011
New Revision: 42027

URL: http://svn.erp5.org?rev=42027&view=rev
Log:
Improve NotImplementedError message, to tell which library
is really missing.

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=42027&r1=42026&r2=42027&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Utils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Utils.py [utf8] Wed Jan  5 14:35:16 2011
@@ -3293,8 +3293,13 @@ def guessEncodingFromText(data, content_
     enconding_detector = magic.Magic(mime_encoding=True)
     return enconding_detector.from_buffer(data)
   else:
-    raise NotImplementedError, 'No encoding detector found.'\
-                                  ' You must install chardet and python-magic'
+    if chardet is None:
+      message = 'No encoding detector found.'\
+                ' You must install chardet and python-magic'
+    else:
+      message = 'No suitable encoding detector found.'\
+                ' You must install python-magic'
+    raise NotImplementedError, message
 
 _reencodeUrlEscapes_map = dict((chr(x), chr(x) in (# safe
                                                    "!'()*-." "0123456789" "_~"



More information about the Erp5-report mailing list