Deleting of non exisiting folders gives no internal error anymore
re-inserting title sort function during upload earlier
pull/550/head
OzzieIsaacs 6 years ago
parent 8d406117ce
commit 694620790c

@ -299,12 +299,16 @@ def delete_book_file(book, calibrepath):
# check that path is 2 elements deep, check that target path has no subfolders
if book.path.count('/') == 1:
path = os.path.join(calibrepath, book.path)
if os.path.isdir(path):
if len(next(os.walk(path))[1]):
web.app.logger.error(
"Deleting book " + str(book.id) + " failed, path has subfolders: " + book.path)
return False
shutil.rmtree(path, ignore_errors=True)
return True
else:
web.app.logger.error("Deleting book " + str(book.id) + " failed, book path not valid: " + book.path)
return False
else:
web.app.logger.error("Deleting book " + str(book.id) + " failed, book path value: "+ book.path)
return False

@ -3311,7 +3311,7 @@ def upload():
db.session.add(db.Comments(upload_comment, book_id))
db.session.commit()
db.session.connection().connection.connection.create_function("title_sort", 1, db.title_sort)
book = db.session.query(db.Books) \
.filter(db.Books.id == book_id).filter(common_filters()).first()
@ -3331,7 +3331,7 @@ def upload():
for author in db_book.authors:
author_names.append(author.name)
if len(request.files.getlist("btn-upload")) < 2:
db.session.connection().connection.connection.create_function("title_sort", 1, db.title_sort)
# db.session.connection().connection.connection.create_function("title_sort", 1, db.title_sort)
cc = db.session.query(db.Custom_Columns).filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).all()
if current_user.role_edit() or current_user.role_admin():
return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc,title=_(u"edit metadata"))

Loading…
Cancel
Save