fixes from tests

This commit is contained in:
Ozzieisaacs
2019-12-30 15:16:09 +01:00
parent 1c18a788f4
commit 1c630eb604
5 changed files with 175 additions and 192 deletions
+7 -8
View File
@@ -43,7 +43,7 @@ from werkzeug.exceptions import default_exceptions
from werkzeug.datastructures import Headers
from werkzeug.security import generate_password_hash, check_password_hash
from . import constants, logger, isoLanguages, services, worker
from . import constants, config, logger, isoLanguages, services, worker
from . import searched_ids, lm, babel, db, ub, config, get_locale, app
from .gdriveutils import getFileFromEbooksFolder, do_gdrive_download
from .helper import common_filters, get_search_results, fill_indexpage, speaking_language, check_valid_domain, \
@@ -93,12 +93,12 @@ def error_http(error):
def internal_error(error):
__, __, tb = sys.exc_info()
# __, __, tb = sys.exc_info()
return render_template('http_error.html',
error_code="Internal Server Error",
error_name=str(error),
issue=True,
error_stack=traceback.format_tb(tb),
error_stack=traceback.format_exc().split("\n"),
instance=config.config_calibre_web_title
), 500
@@ -790,9 +790,7 @@ def get_tasks_status():
@app.route("/reconnect")
def reconnect():
db.session.close()
db.engine.dispose()
db.setup_db()
db.reconnect_db(config)
return json.dumps({})
@web.route("/search", methods=["GET"])
@@ -961,7 +959,7 @@ def advanced_search():
series=series, title=_(u"search"), cc=cc, page="advsearch")
def render_read_books(page, are_read, as_xml=False, order=None):
def render_read_books(page, are_read, as_xml=False, order=None, *args, **kwargs):
order = order or []
if not config.config_read_column:
readBooks = ub.session.query(ub.ReadBook).filter(ub.ReadBook.user_id == int(current_user.id))\
@@ -984,7 +982,8 @@ def render_read_books(page, are_read, as_xml=False, order=None):
entries, random, pagination = fill_indexpage(page, db.Books, db_filter, order)
if as_xml:
xml = render_title_template('feed.xml', entries=entries, pagination=pagination)
currtime = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S+00:00")
xml = render_template(current_time=currtime, instance=config.config_calibre_web_title, *args, **kwargs)
response = make_response(xml)
response.headers["Content-Type"] = "application/xml; charset=utf-8"
return response