Mike Brown <[EMAIL PROTECTED]> writes: > Following up on this 12 Jun 2004 post... > > Garth wrote: >> Thomas Heller wrote: >> >Mike Brown <[EMAIL PROTECTED]> writes: >> >>I thought it would be nice to try to improve the mimetypes module by >> >>having >> >>it, on Windows, query the Registry to get the mapping of filename >> >>extensions >> >>to media types, since the mimetypes code currently just blindly checks >> >>posix-specific paths for httpd-style mapping files. However, it seems that >> >>the >> >>way to get mappings from the Windows registry is excessively slow in >> >>Python. >> >> >> >>I'm told that the reason has to do with the limited subset of APIs that >> >>are >> >>exposed in the _winreg module. I think it is that EnumKey(key, index) is >> >>querying for the entire list of subkeys for the given key every time you >> >>call >> >>it. Or something. Whatever the situation is, the code I tried below is way >> >>slower than I think it ought to be. >> >> >> >>Does anyone have any suggestions (besides "write it in C")? Could _winreg >> >>possibly be improved to provide an iterator or better interface to get the >> >>subkeys? (or certain ones? There are a lot of keys under >> >>HKEY_CLASSES_ROOT, >> >>and I only need the ones that start with a period). >> > >> >See this post I made some time ago: >> ><http://mail.python.org/pipermail/python-dev/2004-January/042198.html> >> > >> >>Should I file this as a feature request? >> > >> >If you still think it should be changed in the core, you should work on >> >a patch. >> > >> I could file a patch if no one else is looking at it. The solution would >> be to use RegEnumKeyEx and remove RegQueryInfoKey. This loses >> compatability with win16 which I guess is ok. >> >> Garth > > I would say it looks like no one else was looking at it, and Garth apparently > didn't submit a patch. It's beyond my means to come up with a patch myself. > Would someone be willing to take a look at it?
There is a patch, but, as so often, work on it has stalled. http://www.python.org/sf/977553 Thomas _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com