Message309291
You can get the same "bad" behavior on a posix system by having a mimetypes file with an incorrect entry in it. That would be a system misconfiguration, as is your Windows registry case, and is outside of Python's control. I suppose we could make it clearer (ie: in that intro paragraph) that the system files are read by default (that is, the built-in tables are only *defaults* unless you specify otherwise).
It is unfortunately true that the mime types in the Windows registry are less reliable than those on unix systems. This has nothing to do with the mimetypes module itself, though ;) I wonder if we should have made the default to be loading windows registry as non-strict, but that ship has sailed, I think.
Checking for at least minimal validity (xxx/yyy) would at least make things a little better on Windows, so I wouldn't object to adding that.
To summarize, my suggestion would be to add a note to the intro paragraph that system files/registry are read by default and override the built-in tables, and add a minimal sanity check on the mime type values read. Adding .sql to the strict list is a separate issue, and would not change the behavior here (unless I'm missing something, which is possible).
There are issues around adding even a minimal validity check, though: do we backport that? Do we silently ignore strings in the wrong format? Do we "fix" a backslash to be a slash? Do we issue a warning for any problems we find? These questions should be discussed if we decide to go this route. |
|
Date |
User |
Action |
Args |
2017-12-31 16:38:10 | r.david.murray | set | recipients:
+ r.david.murray, cheryl.sabella |
2017-12-31 16:38:10 | r.david.murray | set | messageid: <1514738290.34.0.467229070634.issue32462@psf.upfronthosting.co.za> |
2017-12-31 16:38:10 | r.david.murray | link | issue32462 messages |
2017-12-31 16:38:09 | r.david.murray | create | |
|