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 json
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
import mimetypes
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from decimal import Decimal as D
|
from decimal import Decimal as D
|
||||||
|
@ -63,7 +64,9 @@ class PageTests(TestCase):
|
||||||
self.client = Client()
|
self.client = Client()
|
||||||
self.client.login(username='test', password='test')
|
self.client.login(username='test', password='test')
|
||||||
w= Work.objects.create(title="test work",language='en')
|
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):
|
def test_view_by_self(self):
|
||||||
# logged in
|
# logged in
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import datetime
|
import datetime
|
||||||
|
import mimetypes
|
||||||
from os.path import dirname, realpath, join
|
from os.path import dirname, realpath, join
|
||||||
|
|
||||||
import regluit
|
import regluit
|
||||||
|
@ -423,6 +424,8 @@ FORMATS = (
|
||||||
('text','TEXT'),
|
('text','TEXT'),
|
||||||
('mobi','MOBI'),
|
('mobi','MOBI'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# used by MARC. maybe should use python's mimetypes
|
||||||
CONTENT_TYPES = {
|
CONTENT_TYPES = {
|
||||||
'pdf': 'application/pdf',
|
'pdf': 'application/pdf',
|
||||||
'epub': 'application/epub+zip',
|
'epub': 'application/epub+zip',
|
||||||
|
@ -431,6 +434,8 @@ CONTENT_TYPES = {
|
||||||
'mobi': 'application/x-mobipocket-ebook'
|
'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
|
# if you add more of these, make sure core/marc.py can deal
|
||||||
MARC_CHOICES = (
|
MARC_CHOICES = (
|
||||||
('DIRECT', 'Raw link'),
|
('DIRECT', 'Raw link'),
|
||||||
|
|
Loading…
Reference in New Issue