Commit 8402efee authored by Nicolas Delaby's avatar Nicolas Delaby

Improve NotImplementedError message, to tell which library

is really missing.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42027 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 08e5d977
...@@ -3293,8 +3293,13 @@ def guessEncodingFromText(data, content_type='text/html'): ...@@ -3293,8 +3293,13 @@ def guessEncodingFromText(data, content_type='text/html'):
enconding_detector = magic.Magic(mime_encoding=True) enconding_detector = magic.Magic(mime_encoding=True)
return enconding_detector.from_buffer(data) return enconding_detector.from_buffer(data)
else: else:
raise NotImplementedError, 'No encoding detector found.'\ if chardet is None:
message = 'No encoding detector found.'\
' You must install chardet and python-magic' ' 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 _reencodeUrlEscapes_map = dict((chr(x), chr(x) in (# safe
"!'()*-." "0123456789" "_~" "!'()*-." "0123456789" "_~"
......
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