Code cosmetics

Bugfix missing bleach tags (#3080)
Bugfix pdfreader
This commit is contained in:
Ozzie Isaacs
2024-06-20 19:12:46 +02:00
parent f7d5480811
commit 64e4a1155c
47 changed files with 322 additions and 228 deletions
+5 -5
View File
@@ -173,8 +173,8 @@ class SyncToken:
def __str__(self):
return "{},{},{},{},{},{}".format(self.books_last_created,
self.books_last_modified,
self.archive_last_modified,
self.reading_state_last_modified,
self.tags_last_modified,
self.raw_kobo_store_token)
self.books_last_modified,
self.archive_last_modified,
self.reading_state_last_modified,
self.tags_last_modified,
self.raw_kobo_store_token)
+1
View File
@@ -36,6 +36,7 @@ SCOPES = ['openid', 'https://www.googleapis.com/auth/gmail.send', 'https://www.g
def setup_gmail(token):
# If there are no (valid) credentials available, let the user log in.
creds = None
user_info = None
if "token" in token:
creds = Credentials(
token=token['token'],
+6 -3
View File
@@ -32,6 +32,7 @@ except ImportError:
from .. import logger
from ..clean_html import clean_string
class my_GoodreadsClient(GoodreadsClient):
def request(self, *args, **kwargs):
@@ -39,6 +40,7 @@ class my_GoodreadsClient(GoodreadsClient):
req = my_GoodreadsRequest(self, *args, **kwargs)
return req.request()
class GoodreadsRequestException(Exception):
def __init__(self, error_msg, url):
self.error_msg = error_msg
@@ -52,8 +54,8 @@ class my_GoodreadsRequest(GoodreadsRequest):
def request(self):
resp = requests.get(self.host+self.path, params=self.params,
headers={"User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:125.0) "
"Gecko/20100101 Firefox/125.0"})
headers={"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:125.0) "
"Gecko/20100101 Firefox/125.0"})
if resp.status_code != 200:
raise GoodreadsRequestException(resp.reason, self.path)
if self.req_format == 'xml':
@@ -125,7 +127,8 @@ def get_other_books(author_info, library_books=None):
identifiers = []
library_titles = []
if library_books:
identifiers = list(reduce(lambda acc, book: acc + [i.val for i in book.identifiers if i.val], library_books, []))
identifiers = list(
reduce(lambda acc, book: acc + [i.val for i in book.identifiers if i.val], library_books, []))
library_titles = [book.title for book in library_books]
for book in author_info.books:
+5 -2
View File
@@ -30,9 +30,11 @@ except ImportError:
log = logger.create()
class LDAPLogger(object):
def write(self, message):
@staticmethod
def write(message):
try:
log.debug(message.strip("\n").replace("\n", ""))
except Exception:
@@ -71,6 +73,7 @@ class mySimpleLDap(LDAP):
_ldap = mySimpleLDap()
def init_app(app, config):
if config.config_login_type != constants.LOGIN_LDAP:
return
@@ -124,7 +127,7 @@ def init_app(app, config):
log.error(e)
def get_object_details(user=None,query_filter=None):
def get_object_details(user=None, query_filter=None):
return _ldap.get_object_details(user, query_filter=query_filter)