Commit f10f2857 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

new need_guess function

parent 082c3860e479
......@@ -48,6 +48,14 @@ CHARSET_DECL_SEARCH_SIZE = 1024
def need_guess(mimetype, encoding):
"""return True if we can complete given mimetype / encoding information"""
if not mimetype:
return True
if not encoding and is_text_mimetype(mimetype):
return True
return False
def is_text_mimetype(mimetype):
return (mimetype.startswith('text/') or mimetype in TEXT_MIMETYPES)
Supports Markdown
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