Mercurial > hg > agora-ahsan
changeset 179:76abe6d681ea
Add whitelist for other text-like mimetypes
Just XML for now.
author | dellsystem <ilostwaldo@gmail.com> |
---|---|
date | Sat, 20 Oct 2012 23:43:41 -0400 |
parents | df160069b769 |
children | a803a1544126 |
files | apps/bundle/tasks.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/apps/bundle/tasks.py +++ b/apps/bundle/tasks.py @@ -13,6 +13,9 @@ mimetypes.add_type('application/x-gzip', '.tgz') mimetypes.add_type('application/x-bzip2', '.tz2') archive_extensions = ('.zip', '.tgz', '.tar', '.tz2') +text_mimetypes = ( + 'application/xml', +) def process_files_in_dir(bundle, dir_name, parent_dir): @@ -39,7 +42,7 @@ # Only highlight the file contents if it's plain text mime_type = magic.from_file(file_path, mime=True) - if mime_type.startswith('text/'): + if mime_type.startswith('text/') or mime_type in text_mimetypes: with open(file_path, 'rt') as file: # Store the contents of the file in the code field bundle_file.save_file_contents(file)