def cdb_delete_book(ctx, rd, book_ids, library_id): db = get_db(ctx, rd, library_id) if ctx.restriction_for(rd, db): raise HTTPForbidden('Cannot use the delete book interface with a user who has per library restrictions') try: ids = {int(x) for x in book_ids.split(',')} except Exception: raise HTTPBadRequest('invalid book_ids: {}'.format(book_ids)) db.remove_books(ids) books_deleted(ids) return {}
def implementation(db, notify_changes, ids, permanent): db.remove_books(ids, permanent=permanent) if not permanent: delete_service().wait() if notify_changes is not None: notify_changes(books_deleted(ids))