Merge lp:~adiroiban/pocket-lint/1248583-mime-types into lp:pocket-lint

Proposed by Adi Roiban
Status: Merged
Merged at revision: 511
Proposed branch: lp:~adiroiban/pocket-lint/1248583-mime-types
Merge into: lp:pocket-lint
Diff against target: 60 lines (+26/-14)
1 file modified
pocketlint/formatcheck.py (+26/-14)
To merge this branch: bzr merge lp:~adiroiban/pocket-lint/1248583-mime-types
Reviewer Review Type Date Requested Status
Curtis Hovey code Approve
Review via email: mp+194171@code.launchpad.net

Description of the change

Why
---

When running on Windows and even on some Linux versions RHEL/SLES/Gentoo I found that some mime types were missing from the default distribution.

I have no idea why.

This is why I had to manually add them.

This is here to sync my local changes with upstream version.

Hope that you will accept the patch so that I don't have to manually patch each new release.

Changes
-------

I have added some mime types which I have found missing in some Python distributions.

I have also sorted the mime types after a rule which is documented as a comment.

Thanks!

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank Adi.

The mime-types change often; slow moving distros cannot keep up. Windows doesn't even have a native concept of mime-types.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pocketlint/formatcheck.py'
2--- pocketlint/formatcheck.py 2013-10-26 16:04:36 +0000
3+++ pocketlint/formatcheck.py 2013-11-06 15:23:35 +0000
4@@ -183,30 +183,42 @@
5
6 XML_LIKE = (XML, XSLT, HTML, ZPT, ZCML, DOCBOOK)
7
8+ # Sorted after extension.
9+ mimetypes.add_type('text/plain', '.bat')
10+ mimetypes.add_type('text/css', '.css')
11+ mimetypes.add_type('text/x-python-doctest', '.doctest')
12+ mimetypes.add_type('text/html', '.html')
13+ mimetypes.add_type('text/plain', '.ini')
14+ mimetypes.add_type('application/javascript', '.js')
15 mimetypes.add_type('application/json', '.json')
16- mimetypes.add_type('application/x-zope-configuration', '.zcml')
17+ mimetypes.add_type('text/x-log', '.log')
18 mimetypes.add_type('application/x-zope-page-template', '.pt')
19- mimetypes.add_type('text/x-python-doctest', '.doctest')
20+ mimetypes.add_type('text/x-python', '.py')
21+ mimetypes.add_type('text/x-rst', '.rst')
22+ mimetypes.add_type('text/x-sh', '.sh')
23+ mimetypes.add_type('text/x-sql', '.sql')
24 mimetypes.add_type('text/x-twisted-application', '.tac')
25- mimetypes.add_type('text/x-log', '.log')
26- mimetypes.add_type('text/x-rst', '.rst')
27+ mimetypes.add_type('text/plain', '.txt')
28+ mimetypes.add_type('application/x-zope-configuation', '.zcml')
29+
30+ # Sorted after content type.
31 mime_type_language = {
32- 'text/x-python': PYTHON,
33- 'text/x-twisted-application': PYTHON,
34- 'text/x-python-doctest': DOCTEST,
35- 'text/css': CSS,
36- 'text/html': HTML,
37- 'text/plain': TEXT,
38- 'text/x-sql': SQL,
39- 'text/x-log': LOG,
40- 'text/x-rst': RESTRUCTUREDTEXT,
41- 'text/x-go': GO,
42 'application/javascript': JAVASCRIPT,
43 'application/json': JSON,
44 'application/xml': XML,
45 'application/x-sh': SH,
46 'application/x-zope-configuration': ZCML,
47 'application/x-zope-page-template': ZPT,
48+ 'text/css': CSS,
49+ 'text/html': HTML,
50+ 'text/plain': TEXT,
51+ 'text/x-go': GO,
52+ 'text/x-log': LOG,
53+ 'text/x-python': PYTHON,
54+ 'text/x-python-doctest': DOCTEST,
55+ 'text/x-rst': RESTRUCTUREDTEXT,
56+ 'text/x-sql': SQL,
57+ 'text/x-twisted-application': PYTHON,
58 }
59 doctest_pattern = re.compile(
60 r'^.*(doc|test|stories).*/.*\.(txt|doctest)$')

Subscribers

People subscribed via source and target branches

to all changes: