Merge pull request #797 from Gluejar/dj111-errata

Dj111 errata
pull/95/head
eshellman 2018-07-29 17:49:42 -04:00 committed by GitHub
commit 977d9025b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 24 deletions

View File

@ -10,7 +10,7 @@
<meta name="twitter:site" content="@unglueit" />
{% block extra_meta %}{% endblock %}
<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 %}
<script type="text/javascript" src="{{ jquery_home }}"></script>
<script type="text/javascript" src="/static/js/jquery.cookie.js"></script>

View File

@ -117,6 +117,7 @@ urlpatterns = [
url('^404testing/$', TemplateView.as_view(template_name='404.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(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"^feedback/campaign/(?P<campaign_id>\d+)/?$", views.ask_rh, name="ask_rh"),
url(r"^feedback/$", views.feedback, name="feedback"),

View File

@ -498,8 +498,6 @@ def manage_ebooks(request, edition_id, by=None):
file=ebook_form.cleaned_data['file'],
format=ebook_form.cleaned_data['format'],
edition=edition,
active=True,
)
ebook_form.instance.url = new_ebf.file.url
ebook_form.instance.provider = "Unglue.it"

View File

@ -4,12 +4,15 @@ import re
import uuid
from StringIO import StringIO
import datetime
import logging
try:
import lxml.etree as ET
except ImportError:
import xml.etree.ElementTree as ET
logger = logging.getLogger(__name__)
NAMESPACE = {
"dc": "{http://purl.org/dc/elements/1.1/}",
"opf": "{http://www.idpf.org/2007/opf}",
@ -81,14 +84,14 @@ class EPUB(zipfile.ZipFile):
f = self.read("META-INF/container.xml")
except KeyError:
# 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
try:
# There MUST be a full path attribute on first grandchild...
self.opf_path = ET.fromstring(f)[0][0].get("full-path")
except IndexError:
# ...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
# NEW: json-able info tree
@ -104,11 +107,12 @@ class EPUB(zipfile.ZipFile):
# Iterate over <metadata> section, fill EPUB.info["metadata"] dictionary
for i in self.opf.find("{0}metadata".format(NAMESPACE["opf"])):
tag = ns.sub('', i.tag)
if tag not in self.info["metadata"]:
self.info["metadata"][tag] = i.text or i.attrib
else:
self.info["metadata"][tag] = [self.info["metadata"][tag], i.text or i.attrib]
if i.tag:
tag = ns.sub('', i.tag)
if tag not in self.info["metadata"]:
self.info["metadata"][tag] = i.text or i.attrib
else:
self.info["metadata"][tag] = [self.info["metadata"][tag], i.text or i.attrib]
# Get id of the cover in <meta name="cover" />
try:
@ -411,6 +415,8 @@ class EPUB(zipfile.ZipFile):
:type filename: str
:param filename: name of the file to be writte
"""
if isinstance(filename, str):
filename = open(filename,'w')
filename.seek(0)
new_zip = zipfile.ZipFile(filename, 'w')

View File

@ -41,7 +41,7 @@ MEDIA_URL = '/media/'
# set once instead of in all the templates
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"
CKEDITOR_UPLOAD_PATH = ''

13
static/js/jquery-ui-1.11.4.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long