diff --git a/cps/editbooks.py b/cps/editbooks.py index 84bd7b2b..20184bf9 100755 --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -809,7 +809,8 @@ def edit_book(book_id): if "cover_url" in to_save: if to_save["cover_url"]: if not current_user.role_upload(): - return "", (403) + calibre_db.session.rollback() + return "", 403 if to_save["cover_url"].endswith('/static/generic_cover.jpg'): book.has_cover = 0 else: diff --git a/cps/helper.py b/cps/helper.py index af90089b..2daf8494 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -435,7 +435,7 @@ def update_dir_structure_file(book_id, calibrepath, first_author, orignal_filepa # Rename all files from old names to new names try: clean_author_database(renamed_author, calibrepath) - if first_author not in renamed_author: + if first_author and first_author not in renamed_author: clean_author_database([first_author], calibrepath, localbook) if not renamed_author and not orignal_filepath and len(os.listdir(os.path.dirname(path))) == 0: shutil.rmtree(os.path.dirname(path)) @@ -581,7 +581,8 @@ def update_dir_structure(book_id, first_author=None, orignal_filepath=None, db_filename=None, - renamed_author=False): + renamed_author=None): + renamed_author = renamed_author or [] if config.config_use_google_drive: return update_dir_structure_gdrive(book_id, first_author, renamed_author) else: diff --git a/cps/templates/detail.html b/cps/templates/detail.html index ef47bccc..06357ce8 100644 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -38,7 +38,7 @@ {% endif %} {% if g.user.kindle_mail and entry.kindle_list %} {% if entry.kindle_list.__len__() == 1 %} -
{{entry.kindle_list[0]['text']}}
+
{{entry.kindle_list[0]['text']}}
{% else %}
@@ -1982,13 +1982,13 @@ AssertionError: 9 != 10 - + TestLoadMetadata 1 - 0 1 0 0 + 0 Detail @@ -1996,42 +1996,22 @@ AssertionError: 9 != 10 - +
TestLoadMetadata - test_load_metadata
- -
- FAIL -
- - - - + PASS - + TestEditBooksOnGdrive 20 - 20 - 0 + 19 0 + 1 0 Detail @@ -2049,11 +2029,31 @@ AssertionError: 0.0 not greater than or equal to 0.05 - +
TestEditBooksOnGdrive - test_edit_author
- PASS + +
+ ERROR +
+ + + + @@ -4925,8 +4925,8 @@ AssertionError: 200 != 500 Total 390 359 - 17 - 7 + 16 + 8 7   @@ -5315,7 +5315,7 @@ AssertionError: 200 != 500