Message309275
On a Windows 7 system, entering the following:
>>> mime, encoding = mimetypes.guess_type('Untitled.sql')
>>> mime
'text\\plain'
Meaning, the return value is 'text\\plain' instead of 'text/plain'. Tracking this down, it's due to .sql being loaded from the Windows registry and the registry is using the wrong slash.
The mimetypes.guess_type() documentation states:
> The return value is a tuple (type, encoding) where type is None if > the type can’t be guessed (missing or unknown suffix) or a string of
> the form 'type/subtype', usable for a MIME content-type header.
I don't know if guess_type() (or add_types) should check for a valid types, if .sql should be added to the valid types (it's on the IANA page), or if the documentation should be fixed so it doesn't look like a guarantee. Or all three. :-) |
|
Date |
User |
Action |
Args |
2017-12-31 11:07:49 | cheryl.sabella | set | recipients:
+ cheryl.sabella |
2017-12-31 11:07:49 | cheryl.sabella | set | messageid: <1514718469.31.0.467229070634.issue32462@psf.upfronthosting.co.za> |
2017-12-31 11:07:49 | cheryl.sabella | link | issue32462 messages |
2017-12-31 11:07:48 | cheryl.sabella | create | |
|