init mimetypes
parent
f15cfdcc7f
commit
60bc236ab4
File diff suppressed because it is too large
Load Diff
|
@ -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
|
||||
|
|
|
@ -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'),
|
||||
|
|
Loading…
Reference in New Issue