init mimetypes

pull/1/head
eric 2016-03-25 14:13:39 -04:00
parent f15cfdcc7f
commit 60bc236ab4
3 changed files with 1605 additions and 1 deletions

1596
deploy/mime.types Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@ external library imports
import json
import re
import time
import mimetypes
from datetime import timedelta
from decimal import Decimal as D
@ -63,7 +64,9 @@ class PageTests(TestCase):
self.client = Client()
self.client.login(username='test', password='test')
w= Work.objects.create(title="test work",language='en')
def test_setttings(self):
self.assertEqual(mimetypes.guess_type('/whatever/my_file.epub')[0], 'application/epub+zip')
def test_view_by_self(self):
# logged in

View File

@ -1,4 +1,5 @@
import datetime
import mimetypes
from os.path import dirname, realpath, join
import regluit
@ -423,6 +424,8 @@ FORMATS = (
('text','TEXT'),
('mobi','MOBI'),
)
# used by MARC. maybe should use python's mimetypes
CONTENT_TYPES = {
'pdf': 'application/pdf',
'epub': 'application/epub+zip',
@ -431,6 +434,8 @@ CONTENT_TYPES = {
'mobi': 'application/x-mobipocket-ebook'
}
mimetypes.init(["{}/deploy/mime.types".format(PROJECT_DIR)])
# if you add more of these, make sure core/marc.py can deal
MARC_CHOICES = (
('DIRECT', 'Raw link'),