Fixes for flask version 2.1

Fixes for compatibility with sqlalchemy 2.0
This commit is contained in:
Ozzie Isaacs
2021-06-05 18:41:42 +02:00
parent d9f86aecd2
commit 93e8c5be32
4 changed files with 25 additions and 12 deletions
+18 -7
View File
@@ -29,7 +29,7 @@ except ImportError:
import os
from flask import send_file
from flask import send_file, __version__
from . import logger, config
from .about import collect_stats
@@ -43,9 +43,15 @@ def assemble_logfiles(file_name):
with open(f, 'r') as fd:
shutil.copyfileobj(fd, wfd)
wfd.seek(0)
return send_file(wfd,
as_attachment=True,
attachment_filename=os.path.basename(file_name))
if int(__version__.split('.')[0]) < 2:
return send_file(wfd,
as_attachment=True,
attachment_filename=os.path.basename(file_name))
else:
return send_file(wfd,
as_attachment=True,
download_name=os.path.basename(file_name))
def send_debug():
file_list = glob.glob(logger.get_logfile(config.config_logfile) + '*')
@@ -60,6 +66,11 @@ def send_debug():
for fp in file_list:
zf.write(fp, os.path.basename(fp))
memory_zip.seek(0)
return send_file(memory_zip,
as_attachment=True,
attachment_filename="Calibre-Web-debug-pack.zip")
if int(__version__.split('.')[0]) < 2:
return send_file(memory_zip,
as_attachment=True,
attachment_filename="Calibre-Web-debug-pack.zip")
else:
return send_file(memory_zip,
as_attachment=True,
download_name="Calibre-Web-debug-pack.zip")