Merge branch 'master' into develop
# Conflicts: # cps/web.py
This commit is contained in:
commit
06a4af44cc
|
@ -2,7 +2,7 @@
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="single">
|
<div class="single">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-3 col-lg-3 col-xs-12">
|
<div class="col-sm-3 col-lg-3 col-xs-5">
|
||||||
<div class="cover">
|
<div class="cover">
|
||||||
{% if entry.has_cover %}
|
{% if entry.has_cover %}
|
||||||
<img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" />
|
<img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" />
|
||||||
|
|
15
cps/web.py
15
cps/web.py
|
@ -63,13 +63,12 @@ from tornado import version as tornadoVersion
|
||||||
try:
|
try:
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
from imp import reload
|
from imp import reload
|
||||||
from past.builtins import xrange
|
except ImportError as e:
|
||||||
except ImportError:
|
|
||||||
from urllib import quote
|
from urllib import quote
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from flask_login import __version__ as flask_loginVersion
|
from flask_login import __version__ as flask_loginVersion
|
||||||
except ImportError:
|
except ImportError as e:
|
||||||
from flask_login.__about__ import __version__ as flask_loginVersion
|
from flask_login.__about__ import __version__ as flask_loginVersion
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
@ -345,6 +344,10 @@ class Pagination(object):
|
||||||
def iter_pages(self, left_edge=2, left_current=2,
|
def iter_pages(self, left_edge=2, left_current=2,
|
||||||
right_current=5, right_edge=2):
|
right_current=5, right_edge=2):
|
||||||
last = 0
|
last = 0
|
||||||
|
if 'xrange' not in globals():#no xrange in Python3
|
||||||
|
global xrange
|
||||||
|
xrange = range
|
||||||
|
|
||||||
for num in xrange(1, self.pages + 1): # ToDo: can be simplified
|
for num in xrange(1, self.pages + 1): # ToDo: can be simplified
|
||||||
if num <= left_edge or (num > self.page - left_current - 1 and num < self.page + right_current) \
|
if num <= left_edge or (num > self.page - left_current - 1 and num < self.page + right_current) \
|
||||||
or num > self.pages - right_edge:
|
or num > self.pages - right_edge:
|
||||||
|
@ -819,10 +822,10 @@ def get_opds_download_link(book_id, format):
|
||||||
helper.update_download(book_id, int(current_user.id))
|
helper.update_download(book_id, int(current_user.id))
|
||||||
file_name = book.title
|
file_name = book.title
|
||||||
if len(book.authors) > 0:
|
if len(book.authors) > 0:
|
||||||
file_name = book.authors[0].name + '-' + file_name
|
file_name = book.authors[0].name + '_' + file_name
|
||||||
file_name = helper.get_valid_filename(file_name)
|
file_name = helper.get_valid_filename(file_name)
|
||||||
headers={}
|
headers={}
|
||||||
headers["Content-Disposition"] = "attachment; filename*=UTF-8''%s.%s" % (urllib.quote(file_name.encode('utf8')), format)
|
headers["Content-Disposition"] = "attachment; filename*=UTF-8''%s.%s" % (quote(file_name.encode('utf8')), format)
|
||||||
app.logger.info (time.time()-startTime)
|
app.logger.info (time.time()-startTime)
|
||||||
startTime=time.time()
|
startTime=time.time()
|
||||||
if config.config_use_google_drive:
|
if config.config_use_google_drive:
|
||||||
|
@ -1643,7 +1646,7 @@ def get_download_link(book_id, format):
|
||||||
helper.update_download(book_id, int(current_user.id))
|
helper.update_download(book_id, int(current_user.id))
|
||||||
file_name = book.title
|
file_name = book.title
|
||||||
if len(book.authors) > 0:
|
if len(book.authors) > 0:
|
||||||
file_name = book.authors[0].name + '-' + file_name
|
file_name = book.authors[0].name + '_' + file_name
|
||||||
file_name = helper.get_valid_filename(file_name)
|
file_name = helper.get_valid_filename(file_name)
|
||||||
headers={}
|
headers={}
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user