Skip to content

The MimeTypes class cannot ignore global files per instance #68715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
SebastianNoack mannequin opened this issue Jun 29, 2015 · 1 comment
Open

The MimeTypes class cannot ignore global files per instance #68715

SebastianNoack mannequin opened this issue Jun 29, 2015 · 1 comment
Labels
3.13 bugs and security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@SebastianNoack
Copy link
Mannequin

SebastianNoack mannequin commented Jun 29, 2015

BPO 24527

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2015-06-29.11:11:47.824>
labels = ['type-feature', 'library', '3.11']
title = 'The MimeTypes class cannot ignore global files per instance'
updated_at = <Date 2022-01-20.22:55:09.698>
user = 'https://bugs.python.org/SebastianNoack'

bugs.python.org fields:

activity = <Date 2022-01-20.22:55:09.698>
actor = 'iritkatriel'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2015-06-29.11:11:47.824>
creator = 'Sebastian Noack'
dependencies = []
files = []
hgrepos = []
issue_num = 24527
keywords = []
message_count = 1.0
messages = ['245930']
nosy_count = 2.0
nosy_names = ['Sebastian Noack', 'Wladimir Palant']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue24527'
versions = ['Python 3.11']

@SebastianNoack
Copy link
Mannequin Author

SebastianNoack mannequin commented Jun 29, 2015

In order to prevent the mimetypes module from considering global files and registry entries, you have to call mimetypes.init([]). However, this will enforce that behavior globally, and only works if the module wasn't initialized yet.

There is also a similar argument in the mimetypes.MimeTypes() constructor, however the list of files passed there are considered additionally. But there is no way to prevent an individual MinmeTypes instance to consider global files.

Adding a "ignore_global_types" option would be trivial too add to the MimeTypes constructor, and would be extremely useful.

@SebastianNoack SebastianNoack mannequin added type-bug An unexpected behavior, bug, or error stdlib Python modules in the Lib dir labels Jun 29, 2015
@iritkatriel iritkatriel added 3.11 only security fixes type-feature A feature request or enhancement and removed type-bug An unexpected behavior, bug, or error labels Jan 20, 2022
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@iritkatriel iritkatriel added 3.13 bugs and security fixes and removed 3.11 only security fixes labels May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant