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
-25
View File
@@ -990,17 +990,6 @@ def edit_book_comments(comments, book):
modify_date = False
if comments:
comments = clean_string(comments, book.id)
#try:
# if BLEACH:
# comments = clean_html(comments, tags=set(), attributes=set())
# else:
# comments = clean_html(comments)
#except ParserError as e:
# log.error("Comments of book {} are corrupted: {}".format(book.id, e))
# comments = ""
#except TypeError as e:
# log.error("Comments can't be parsed, maybe 'lxml' is too new, try installing 'bleach': {}".format(e))
# comments = ""
if len(book.comments):
if book.comments[0].text != comments:
book.comments[0].text = comments
@@ -1059,18 +1048,6 @@ def edit_cc_data_value(book_id, book, c, to_save, cc_db_value, cc_string):
to_save[cc_string] = Markup(to_save[cc_string]).unescape()
if to_save[cc_string]:
to_save[cc_string] = clean_string(to_save[cc_string], book_id)
#try:
# if BLEACH:
# to_save[cc_string] = clean_html(to_save[cc_string], tags=set(), attributes=set())
# else:
# to_save[cc_string] = clean_html(to_save[cc_string])
#except ParserError as e:
# log.error("Customs Comments of book {} are corrupted: {}".format(book_id, e))
# to_save[cc_string] = ""
#except TypeError as e:
# to_save[cc_string] = ""
# log.error("Customs Comments can't be parsed, maybe 'lxml' is too new, "
# "try installing 'bleach': {}".format(e))
elif c.datatype == 'datetime':
try:
to_save[cc_string] = datetime.strptime(to_save[cc_string], "%Y-%m-%d")
@@ -1297,8 +1274,6 @@ def search_objects_remove(db_book_object, db_type, input_elements):
del_elements = []
for c_elements in db_book_object:
found = False
#if db_type == 'languages':
# type_elements = c_elements.lang_code
if db_type == 'custom':
type_elements = c_elements.value
else: