diff --git a/cps/editbooks.py b/cps/editbooks.py index 6e95279b..d60150af 100755 --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -810,7 +810,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 db31a556..0081f327 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -437,7 +437,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)) @@ -585,7 +585,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 3bcf5cc6..7e720e55 100644 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -39,7 +39,7 @@ {% endif %} {% if g.user.kindle_mail and entry.kindle_list %} {% if entry.kindle_list.__len__() == 1 %} -
Traceback (most recent call last): - File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_metadata.py", line 136, in test_load_metadata - self.assertGreaterEqual(diff(BytesIO(cover), BytesIO(original_cover), delete_diff_file=True), 0.05) -AssertionError: 0.0 not greater than or equal to 0.05-
Traceback (most recent call last): + File "/home/ozzie/Development/calibre-web-test/test/test_edit_ebooks_gdrive.py", line 300, in test_edit_author + self.assertEqual(u'O0ü 执', values['author'][0]) +IndexError: list index out of range+