Merge remote-tracking branch 'opds/bugfix_2419'

Bugfix send emails
This commit is contained in:
Ozzie Isaacs 2022-06-06 09:00:09 +02:00
commit f44d42f834
5 changed files with 966 additions and 712 deletions

View File

@ -1269,8 +1269,8 @@ def update_mailsettings():
_config_string(to_save, "mail_password") _config_string(to_save, "mail_password")
_config_int(to_save, "mail_size", lambda y: int(y)*1024*1024) _config_int(to_save, "mail_size", lambda y: int(y)*1024*1024)
config.mail_server = to_save.get('mail_server', "").strip() config.mail_server = to_save.get('mail_server', "").strip()
config.mail_from = to_save.get('mail_login', "").strip() config.mail_from = to_save.get('mail_from', "").strip()
config.email = to_save.get('mail_login', "").strip() config.mail_login = to_save.get('mail_login', "").strip()
try: try:
config.save() config.save()
except (OperationalError, InvalidRequestError) as e: except (OperationalError, InvalidRequestError) as e:
@ -1671,9 +1671,10 @@ def _db_configuration_update_helper():
if db_change or not db_valid or not config.db_configured \ if db_change or not db_valid or not config.db_configured \
or config.config_calibre_dir != to_save["config_calibre_dir"]: or config.config_calibre_dir != to_save["config_calibre_dir"]:
if not calibre_db.setup_db(to_save['config_calibre_dir'], ub.app_DB_path): if not os.path.exists(metadata_db) or not to_save['config_calibre_dir']:
return _db_configuration_result(_('DB Location is not Valid, Please Enter Correct Path'), return _db_configuration_result(_('DB Location is not Valid, Please Enter Correct Path'), gdrive_error)
gdrive_error) else:
calibre_db.setup_db(to_save['config_calibre_dir'], ub.app_DB_path)
config.store_calibre_uuid(calibre_db, db.Library_Id) config.store_calibre_uuid(calibre_db, db.Library_Id)
# if db changed -> delete shelfs, delete download books, delete read books, kobo sync... # if db changed -> delete shelfs, delete download books, delete read books, kobo sync...
if db_change: if db_change:

View File

@ -567,12 +567,12 @@ class CalibreDB:
if not config_calibre_dir: if not config_calibre_dir:
cls.config.invalidate() cls.config.invalidate()
return False return None
dbpath = os.path.join(config_calibre_dir, "metadata.db") dbpath = os.path.join(config_calibre_dir, "metadata.db")
if not os.path.exists(dbpath): if not os.path.exists(dbpath):
cls.config.invalidate() cls.config.invalidate()
return False return None
try: try:
cls.engine = create_engine('sqlite://', cls.engine = create_engine('sqlite://',
@ -588,7 +588,7 @@ class CalibreDB:
# conn.text_factory = lambda b: b.decode(errors = 'ignore') possible fix for #1302 # conn.text_factory = lambda b: b.decode(errors = 'ignore') possible fix for #1302
except Exception as ex: except Exception as ex:
cls.config.invalidate(ex) cls.config.invalidate(ex)
return False return None
cls.config.db_configured = True cls.config.db_configured = True
@ -598,7 +598,7 @@ class CalibreDB:
cls.setup_db_cc_classes(cc) cls.setup_db_cc_classes(cc)
except OperationalError as e: except OperationalError as e:
log.error_or_exception(e) log.error_or_exception(e)
return False return None
cls.session_factory = scoped_session(sessionmaker(autocommit=False, cls.session_factory = scoped_session(sessionmaker(autocommit=False,
autoflush=True, autoflush=True,
@ -607,7 +607,6 @@ class CalibreDB:
inst.init_session() inst.init_session()
cls._init = True cls._init = True
return True
def get_book(self, book_id): def get_book(self, book_id):
return self.session.query(Books).filter(Books.id == book_id).first() return self.session.query(Books).filter(Books.id == book_id).first()

View File

@ -42,7 +42,7 @@ install_requires =
werkzeug<2.1.0 werkzeug<2.1.0
Babel>=1.3,<3.0 Babel>=1.3,<3.0
Flask-Babel>=0.11.1,<2.1.0 Flask-Babel>=0.11.1,<2.1.0
Flask-Login>=0.3.2,<0.6.1 Flask-Login>=0.3.2,<0.6.2
Flask-Principal>=0.3.2,<0.5.1 Flask-Principal>=0.3.2,<0.5.1
backports_abc>=0.4 backports_abc>=0.4
Flask>=1.0.2,<2.1.0 Flask>=1.0.2,<2.1.0
@ -97,5 +97,5 @@ comics =
natsort>=2.2.0,<8.2.0 natsort>=2.2.0,<8.2.0
comicapi>=2.2.0,<2.3.0 comicapi>=2.2.0,<2.3.0
kobo = kobo =
jsonschema>=3.2.0,<4.5.0 jsonschema>=3.2.0,<4.6.0

File diff suppressed because it is too large Load Diff