commit
977d9025b6
|
@ -10,7 +10,7 @@
|
||||||
<meta name="twitter:site" content="@unglueit" />
|
<meta name="twitter:site" content="@unglueit" />
|
||||||
{% block extra_meta %}{% endblock %}
|
{% block extra_meta %}{% endblock %}
|
||||||
<link type="text/css" rel="stylesheet" href="{% sass_src 'scss/sitewide4.scss' %}" />
|
<link type="text/css" rel="stylesheet" href="{% sass_src 'scss/sitewide4.scss' %}" />
|
||||||
<link REL="SHORTCUT ICON" HREF="/static/images/favicon.ico">
|
<link rel="SHORTCUT ICON" href="{% url 'favicon'%}">
|
||||||
{% block extra_css %}{% endblock %}
|
{% block extra_css %}{% endblock %}
|
||||||
<script type="text/javascript" src="{{ jquery_home }}"></script>
|
<script type="text/javascript" src="{{ jquery_home }}"></script>
|
||||||
<script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
|
<script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
|
||||||
|
|
|
@ -117,6 +117,7 @@ urlpatterns = [
|
||||||
url('^404testing/$', TemplateView.as_view(template_name='404.html') ),
|
url('^404testing/$', TemplateView.as_view(template_name='404.html') ),
|
||||||
url('^500testing/$', TemplateView.as_view(template_name='500.html')),
|
url('^500testing/$', TemplateView.as_view(template_name='500.html')),
|
||||||
url('^robots.txt$', TemplateView.as_view(template_name='robots.txt',content_type='text/plain')),
|
url('^robots.txt$', TemplateView.as_view(template_name='robots.txt',content_type='text/plain')),
|
||||||
|
url(r'favicon.ico$', views.static_redirect_view, {'file_name': 'favicon.ico', 'dir': 'images'}, name="favicon"),
|
||||||
url(r"^emailshare/(?P<action>\w*)/?$", views.emailshare, name="emailshare"),
|
url(r"^emailshare/(?P<action>\w*)/?$", views.emailshare, name="emailshare"),
|
||||||
url(r"^feedback/campaign/(?P<campaign_id>\d+)/?$", views.ask_rh, name="ask_rh"),
|
url(r"^feedback/campaign/(?P<campaign_id>\d+)/?$", views.ask_rh, name="ask_rh"),
|
||||||
url(r"^feedback/$", views.feedback, name="feedback"),
|
url(r"^feedback/$", views.feedback, name="feedback"),
|
||||||
|
|
|
@ -498,8 +498,6 @@ def manage_ebooks(request, edition_id, by=None):
|
||||||
file=ebook_form.cleaned_data['file'],
|
file=ebook_form.cleaned_data['file'],
|
||||||
format=ebook_form.cleaned_data['format'],
|
format=ebook_form.cleaned_data['format'],
|
||||||
edition=edition,
|
edition=edition,
|
||||||
active=True,
|
|
||||||
|
|
||||||
)
|
)
|
||||||
ebook_form.instance.url = new_ebf.file.url
|
ebook_form.instance.url = new_ebf.file.url
|
||||||
ebook_form.instance.provider = "Unglue.it"
|
ebook_form.instance.provider = "Unglue.it"
|
||||||
|
|
|
@ -4,12 +4,15 @@ import re
|
||||||
import uuid
|
import uuid
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
import datetime
|
import datetime
|
||||||
|
import logging
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import lxml.etree as ET
|
import lxml.etree as ET
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
NAMESPACE = {
|
NAMESPACE = {
|
||||||
"dc": "{http://purl.org/dc/elements/1.1/}",
|
"dc": "{http://purl.org/dc/elements/1.1/}",
|
||||||
"opf": "{http://www.idpf.org/2007/opf}",
|
"opf": "{http://www.idpf.org/2007/opf}",
|
||||||
|
@ -81,14 +84,14 @@ class EPUB(zipfile.ZipFile):
|
||||||
f = self.read("META-INF/container.xml")
|
f = self.read("META-INF/container.xml")
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# By specification, there MUST be a container.xml in EPUB
|
# By specification, there MUST be a container.xml in EPUB
|
||||||
print "The %s file is not a valid OCF." % str(filename)
|
logger.warning("The %s file is not a valid OCF." % str(filename))
|
||||||
raise InvalidEpub
|
raise InvalidEpub
|
||||||
try:
|
try:
|
||||||
# There MUST be a full path attribute on first grandchild...
|
# There MUST be a full path attribute on first grandchild...
|
||||||
self.opf_path = ET.fromstring(f)[0][0].get("full-path")
|
self.opf_path = ET.fromstring(f)[0][0].get("full-path")
|
||||||
except IndexError:
|
except IndexError:
|
||||||
# ...else the file is invalid.
|
# ...else the file is invalid.
|
||||||
print "The %s file is not a valid OCF." % str(filename)
|
logger.warning("The %s file is not a valid OCF." % str(filename))
|
||||||
raise InvalidEpub
|
raise InvalidEpub
|
||||||
|
|
||||||
# NEW: json-able info tree
|
# NEW: json-able info tree
|
||||||
|
@ -104,6 +107,7 @@ class EPUB(zipfile.ZipFile):
|
||||||
|
|
||||||
# Iterate over <metadata> section, fill EPUB.info["metadata"] dictionary
|
# Iterate over <metadata> section, fill EPUB.info["metadata"] dictionary
|
||||||
for i in self.opf.find("{0}metadata".format(NAMESPACE["opf"])):
|
for i in self.opf.find("{0}metadata".format(NAMESPACE["opf"])):
|
||||||
|
if i.tag:
|
||||||
tag = ns.sub('', i.tag)
|
tag = ns.sub('', i.tag)
|
||||||
if tag not in self.info["metadata"]:
|
if tag not in self.info["metadata"]:
|
||||||
self.info["metadata"][tag] = i.text or i.attrib
|
self.info["metadata"][tag] = i.text or i.attrib
|
||||||
|
@ -411,6 +415,8 @@ class EPUB(zipfile.ZipFile):
|
||||||
:type filename: str
|
:type filename: str
|
||||||
:param filename: name of the file to be writte
|
:param filename: name of the file to be writte
|
||||||
"""
|
"""
|
||||||
|
if isinstance(filename, str):
|
||||||
|
filename = open(filename,'w')
|
||||||
|
|
||||||
filename.seek(0)
|
filename.seek(0)
|
||||||
new_zip = zipfile.ZipFile(filename, 'w')
|
new_zip = zipfile.ZipFile(filename, 'w')
|
||||||
|
|
|
@ -41,7 +41,7 @@ MEDIA_URL = '/media/'
|
||||||
|
|
||||||
# set once instead of in all the templates
|
# set once instead of in all the templates
|
||||||
JQUERY_HOME = "/static/js/jquery-1.12.4.min.js"
|
JQUERY_HOME = "/static/js/jquery-1.12.4.min.js"
|
||||||
JQUERY_UI_HOME = "/static/js/jquery-ui-1.12.1.custom.min.js"
|
JQUERY_UI_HOME = "/static/js/jquery-ui-1.11.4.custom.min.js"
|
||||||
JQUERY_UI_THEME = "/static/css/ui-lightness/jquery-ui-1.11.4.min.css"
|
JQUERY_UI_THEME = "/static/css/ui-lightness/jquery-ui-1.11.4.min.css"
|
||||||
|
|
||||||
CKEDITOR_UPLOAD_PATH = ''
|
CKEDITOR_UPLOAD_PATH = ''
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue