This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: mimetypes add_type has bogus self parameter
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: doerwalter Nosy List: cliffwells18, doerwalter
Priority: normal Keywords:

Created on 2004-08-23 01:39 by cliffwells18, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg22174 - (view) Author: Cliff Wells (cliffwells18) (Python triager) Date: 2004-08-23 01:39
Python 2.3.3

mimetypes module defines the following function:

def add_type(self, type, ext, strict=True)

This is incorrect as there should be no "self" argument.
msg22175 - (view) Author: Cliff Wells (cliffwells18) (Python triager) Date: 2004-08-23 01:48
Logged In: YES 
user_id=340357

Actually, the real problem appears to be that
mimetypes.init() isn't called automatically as the
documentation suggests.

import mimetypes
mimetypes.add_type('text/xml', '.rss')

doesn't work but

import mimetypes
mimetypes.init()
mimetypes.add_type('text/xml', '.rss')

does.

From
http://www.python.org/doc/current/lib/module-mimetypes.html:

"The functions described below provide the primary interface
for this module. If the module has not been initialized,
they will call init() if they rely on the information init()
sets up."
msg22176 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-08-23 08:15
Logged In: YES 
user_id=89016

The problem with the bogus self parameter has already been 
fixed in CVS (both on the trunk (revision 1.30) and on the 
maintainance branch (revision 1.28.8.2 which went into 
release 2.3.4). The global add_type() *does* call init(). Can 
you check whether your problem is gone with 2.3.4?
msg22177 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2004-09-06 19:35
Logged In: YES 
user_id=89016

Closing the bug as "out of date". If this is still an issue, please 
feel free to reopen it.
History
Date User Action Args
2022-04-11 14:56:06adminsetgithub: 40805
2004-08-23 01:39:44cliffwells18create