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
=== modified file 'pocketlint/formatcheck.py'
--- pocketlint/formatcheck.py 2013-10-26 16:04:36 +0000
+++ pocketlint/formatcheck.py 2013-11-06 15:23:35 +0000
@@ -183,30 +183,42 @@
183183
184 XML_LIKE = (XML, XSLT, HTML, ZPT, ZCML, DOCBOOK)184 XML_LIKE = (XML, XSLT, HTML, ZPT, ZCML, DOCBOOK)
185185
186 # Sorted after extension.
187 mimetypes.add_type('text/plain', '.bat')
188 mimetypes.add_type('text/css', '.css')
189 mimetypes.add_type('text/x-python-doctest', '.doctest')
190 mimetypes.add_type('text/html', '.html')
191 mimetypes.add_type('text/plain', '.ini')
192 mimetypes.add_type('application/javascript', '.js')
186 mimetypes.add_type('application/json', '.json')193 mimetypes.add_type('application/json', '.json')
187 mimetypes.add_type('application/x-zope-configuration', '.zcml')194 mimetypes.add_type('text/x-log', '.log')
188 mimetypes.add_type('application/x-zope-page-template', '.pt')195 mimetypes.add_type('application/x-zope-page-template', '.pt')
189 mimetypes.add_type('text/x-python-doctest', '.doctest')196 mimetypes.add_type('text/x-python', '.py')
197 mimetypes.add_type('text/x-rst', '.rst')
198 mimetypes.add_type('text/x-sh', '.sh')
199 mimetypes.add_type('text/x-sql', '.sql')
190 mimetypes.add_type('text/x-twisted-application', '.tac')200 mimetypes.add_type('text/x-twisted-application', '.tac')
191 mimetypes.add_type('text/x-log', '.log')201 mimetypes.add_type('text/plain', '.txt')
192 mimetypes.add_type('text/x-rst', '.rst')202 mimetypes.add_type('application/x-zope-configuation', '.zcml')
203
204 # Sorted after content type.
193 mime_type_language = {205 mime_type_language = {
194 'text/x-python': PYTHON,
195 'text/x-twisted-application': PYTHON,
196 'text/x-python-doctest': DOCTEST,
197 'text/css': CSS,
198 'text/html': HTML,
199 'text/plain': TEXT,
200 'text/x-sql': SQL,
201 'text/x-log': LOG,
202 'text/x-rst': RESTRUCTUREDTEXT,
203 'text/x-go': GO,
204 'application/javascript': JAVASCRIPT,206 'application/javascript': JAVASCRIPT,
205 'application/json': JSON,207 'application/json': JSON,
206 'application/xml': XML,208 'application/xml': XML,
207 'application/x-sh': SH,209 'application/x-sh': SH,
208 'application/x-zope-configuration': ZCML,210 'application/x-zope-configuration': ZCML,
209 'application/x-zope-page-template': ZPT,211 'application/x-zope-page-template': ZPT,
212 'text/css': CSS,
213 'text/html': HTML,
214 'text/plain': TEXT,
215 'text/x-go': GO,
216 'text/x-log': LOG,
217 'text/x-python': PYTHON,
218 'text/x-python-doctest': DOCTEST,
219 'text/x-rst': RESTRUCTUREDTEXT,
220 'text/x-sql': SQL,
221 'text/x-twisted-application': PYTHON,
210 }222 }
211 doctest_pattern = re.compile(223 doctest_pattern = re.compile(
212 r'^.*(doc|test|stories).*/.*\.(txt|doctest)$')224 r'^.*(doc|test|stories).*/.*\.(txt|doctest)$')

Subscribers

People subscribed via source and target branches

to all changes: