mirror of
https://github.com/janeczku/calibre-web
synced 2025-11-08 11:13:02 +00:00
Update error handling book table edit
This commit is contained in:
@@ -214,7 +214,7 @@ def table_get_custom_enum(c_id):
|
|||||||
@login_required_if_no_ano
|
@login_required_if_no_ano
|
||||||
@edit_required
|
@edit_required
|
||||||
def edit_list_book(param):
|
def edit_list_book(param):
|
||||||
vals = request.get_json() # form.to_dict(flat=False)
|
vals = request.get_json()
|
||||||
return edit_book_param(param, vals)
|
return edit_book_param(param, vals)
|
||||||
|
|
||||||
@editbook.route("/ajax/editselectedbooks", methods=['POST'])
|
@editbook.route("/ajax/editselectedbooks", methods=['POST'])
|
||||||
@@ -232,40 +232,40 @@ def edit_selected_books():
|
|||||||
languages = d.get('languages')
|
languages = d.get('languages')
|
||||||
publishers = d.get('publishers')
|
publishers = d.get('publishers')
|
||||||
comments = d.get('comments')
|
comments = d.get('comments')
|
||||||
checkA = d.get('checkA')
|
|
||||||
|
|
||||||
vals = {
|
vals = {
|
||||||
"pk": selections,
|
"pk": selections,
|
||||||
"value": None,
|
"value": None,
|
||||||
"checkA": checkA,
|
"checkA": d.get('checkA'),
|
||||||
|
"checkT": d.get('checkT'),
|
||||||
}
|
}
|
||||||
if title:
|
if title:
|
||||||
vals['value'] = title
|
vals['value'] = title
|
||||||
edit_book_param('title', vals)
|
res_title = edit_book_param('title', vals)
|
||||||
if title_sort:
|
if title_sort:
|
||||||
vals['value'] = title_sort
|
vals['value'] = title_sort
|
||||||
edit_book_param('sort', vals)
|
res1_tit_sort = edit_book_param('sort', vals)
|
||||||
if author_sort:
|
if author_sort:
|
||||||
vals['value'] = author_sort
|
vals['value'] = author_sort
|
||||||
edit_book_param('author_sort', vals)
|
res_author_sort = edit_book_param('author_sort', vals)
|
||||||
if authors:
|
if authors:
|
||||||
vals['value'] = authors
|
vals['value'] = authors
|
||||||
edit_book_param('authors', vals)
|
res_author = edit_book_param('authors', vals)
|
||||||
if categories:
|
if categories:
|
||||||
vals['value'] = categories
|
vals['value'] = categories
|
||||||
edit_book_param('tags', vals)
|
res_cat = edit_book_param('tags', vals)
|
||||||
if series:
|
if series:
|
||||||
vals['value'] = series
|
vals['value'] = series
|
||||||
edit_book_param('series', vals)
|
res_series = edit_book_param('series', vals)
|
||||||
if languages:
|
if languages:
|
||||||
vals['value'] = languages
|
vals['value'] = languages
|
||||||
edit_book_param('languages', vals)
|
res_lang = edit_book_param('languages', vals)
|
||||||
if publishers:
|
if publishers:
|
||||||
vals['value'] = publishers
|
vals['value'] = publishers
|
||||||
edit_book_param('publishers', vals)
|
res_pup = edit_book_param('publishers', vals)
|
||||||
if comments:
|
if comments:
|
||||||
vals['value'] = comments
|
vals['value'] = comments
|
||||||
edit_book_param('comments', vals)
|
res_comments = edit_book_param('comments', vals)
|
||||||
return json.dumps({'success': True})
|
return json.dumps({'success': True})
|
||||||
|
|
||||||
# Separated from /editbooks so that /editselectedbooks can also use this
|
# Separated from /editbooks so that /editselectedbooks can also use this
|
||||||
@@ -283,9 +283,16 @@ def edit_selected_books():
|
|||||||
@edit_required
|
@edit_required
|
||||||
def edit_book_param(param, vals):
|
def edit_book_param(param, vals):
|
||||||
elements = vals.get('pk',[])
|
elements = vals.get('pk',[])
|
||||||
|
if not vals.get('value'):
|
||||||
|
return jsonify(success=False, msg=_("Value is missing on request"))
|
||||||
|
if not elements :
|
||||||
|
return jsonify(success=False, msg=_("Oops! Selected book is unavailable. File does not exist or is not accessible"))
|
||||||
ret = {}
|
ret = {}
|
||||||
for elem in elements:
|
for elem in elements:
|
||||||
book = calibre_db.get_book(elem)
|
book = calibre_db.get_book(elem)
|
||||||
|
if not book:
|
||||||
|
ret = jsonify(success=False, msg=_("Oops! Selected book is unavailable. File does not exist or is not accessible"))
|
||||||
|
continue
|
||||||
calibre_db.create_functions(config)
|
calibre_db.create_functions(config)
|
||||||
sort_param = ""
|
sort_param = ""
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -37,20 +37,20 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-6 col-md-6 col-sm-offset-3" style="margin-top:50px;">
|
<div class="col-xs-6 col-md-6 col-sm-offset-3" style="margin-top:50px;">
|
||||||
|
|
||||||
<p class='text-justify attribute'><strong>Start Time: </strong>2024-12-12 21:32:32</p>
|
<p class='text-justify attribute'><strong>Start Time: </strong>2024-12-13 18:37:11</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-6 col-md-6 col-sm-offset-3">
|
<div class="col-xs-6 col-md-6 col-sm-offset-3">
|
||||||
|
|
||||||
<p class='text-justify attribute'><strong>Stop Time: </strong>2024-12-13 04:26:53</p>
|
<p class='text-justify attribute'><strong>Stop Time: </strong>2024-12-14 01:56:41</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-6 col-md-6 col-sm-offset-3">
|
<div class="col-xs-6 col-md-6 col-sm-offset-3">
|
||||||
<p class='text-justify attribute'><strong>Duration: </strong>5h 49 min</p>
|
<p class='text-justify attribute'><strong>Duration: </strong>6h 13 min</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2030,13 +2030,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<tr id="su" class="errorClass">
|
<tr id="su" class="failClass">
|
||||||
<td>TestLoadMetadata</td>
|
<td>TestLoadMetadata</td>
|
||||||
<td class="text-center">1</td>
|
<td class="text-center">1</td>
|
||||||
<td class="text-center">0</td>
|
<td class="text-center">0</td>
|
||||||
<td class="text-center">0</td>
|
|
||||||
<td class="text-center">1</td>
|
<td class="text-center">1</td>
|
||||||
<td class="text-center">0</td>
|
<td class="text-center">0</td>
|
||||||
|
<td class="text-center">0</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a onclick="showClassDetail('c18', 1)">Detail</a>
|
<a onclick="showClassDetail('c18', 1)">Detail</a>
|
||||||
</td>
|
</td>
|
||||||
@@ -2044,26 +2044,26 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<tr id="et18.1" class="none bg-info">
|
<tr id="ft18.1" class="none bg-danger">
|
||||||
<td>
|
<td>
|
||||||
<div class='testcase'>TestLoadMetadata - test_load_metadata</div>
|
<div class='testcase'>TestLoadMetadata - test_load_metadata</div>
|
||||||
</td>
|
</td>
|
||||||
<td colspan='6'>
|
<td colspan='6'>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_et18.1')">ERROR</a>
|
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft18.1')">FAIL</a>
|
||||||
</div>
|
</div>
|
||||||
<!--css div popup start-->
|
<!--css div popup start-->
|
||||||
<div id="div_et18.1" class="popup_window test_output" style="display:block;">
|
<div id="div_ft18.1" class="popup_window test_output" style="display:block;">
|
||||||
<div class='close_button pull-right'>
|
<div class='close_button pull-right'>
|
||||||
<button type="button" class="close" aria-label="Close" onfocus="this.blur();"
|
<button type="button" class="close" aria-label="Close" onfocus="this.blur();"
|
||||||
onclick="document.getElementById('div_et18.1').style.display='none'"><span
|
onclick="document.getElementById('div_ft18.1').style.display='none'"><span
|
||||||
aria-hidden="true">×</span></button>
|
aria-hidden="true">×</span></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-left pull-left">
|
<div class="text-left pull-left">
|
||||||
<pre class="text-left">Traceback (most recent call last):
|
<pre class="text-left">Traceback (most recent call last):
|
||||||
File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_metadata.py", line 99, in test_load_metadata
|
File "/home/ozzie/Development/calibre-web-test/test/test_edit_books_metadata.py", line 220, in test_load_metadata
|
||||||
if results[cont]['source'] == 'https://comicvine.gamespot.com/':
|
self.assertLessEqual(diff(BytesIO(cover), BytesIO(new_cover), delete_diff_file=True), 0.02)
|
||||||
IndexError: list index out of range</pre>
|
AssertionError: 0.02499824076612272 not less than or equal to 0.02</pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -3539,11 +3539,11 @@ IndexError: list index out of range</pre>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<tr id="su" class="failClass">
|
<tr id="su" class="passClass">
|
||||||
<td>TestMergeBooksList</td>
|
<td>TestMergeBooksList</td>
|
||||||
<td class="text-center">2</td>
|
<td class="text-center">2</td>
|
||||||
<td class="text-center">1</td>
|
<td class="text-center">2</td>
|
||||||
<td class="text-center">1</td>
|
<td class="text-center">0</td>
|
||||||
<td class="text-center">0</td>
|
<td class="text-center">0</td>
|
||||||
<td class="text-center">0</td>
|
<td class="text-center">0</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
@@ -3562,31 +3562,11 @@ IndexError: list index out of range</pre>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<tr id="ft37.2" class="none bg-danger">
|
<tr id='pt37.2' class='hiddenRow bg-success'>
|
||||||
<td>
|
<td>
|
||||||
<div class='testcase'>TestMergeBooksList - test_delete_book</div>
|
<div class='testcase'>TestMergeBooksList - test_delete_book</div>
|
||||||
</td>
|
</td>
|
||||||
<td colspan='6'>
|
<td colspan='6' align='center'>PASS</td>
|
||||||
<div class="text-center">
|
|
||||||
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft37.2')">FAIL</a>
|
|
||||||
</div>
|
|
||||||
<!--css div popup start-->
|
|
||||||
<div id="div_ft37.2" class="popup_window test_output" style="display:block;">
|
|
||||||
<div class='close_button pull-right'>
|
|
||||||
<button type="button" class="close" aria-label="Close" onfocus="this.blur();"
|
|
||||||
onclick="document.getElementById('div_ft37.2').style.display='none'"><span
|
|
||||||
aria-hidden="true">×</span></button>
|
|
||||||
</div>
|
|
||||||
<div class="text-left pull-left">
|
|
||||||
<pre class="text-left">Traceback (most recent call last):
|
|
||||||
File "/home/ozzie/Development/calibre-web-test/test/test_merge_books_list.py", line 67, in test_delete_book
|
|
||||||
self.assertTrue(self.check_element_on_page((By.ID, "flash_warning")))
|
|
||||||
AssertionError: False is not true</pre>
|
|
||||||
</div>
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
</div>
|
|
||||||
<!--css div popup end-->
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
@@ -5821,9 +5801,9 @@ AssertionError: False is not true</pre>
|
|||||||
<tr id='total_row' class="text-center bg-grey">
|
<tr id='total_row' class="text-center bg-grey">
|
||||||
<td>Total</td>
|
<td>Total</td>
|
||||||
<td>523</td>
|
<td>523</td>
|
||||||
<td>514</td>
|
<td>515</td>
|
||||||
<td>1</td>
|
|
||||||
<td>1</td>
|
<td>1</td>
|
||||||
|
<td>0</td>
|
||||||
<td>7</td>
|
<td>7</td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -6368,7 +6348,7 @@ AssertionError: False is not true</pre>
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
drawCircle(514, 1, 1, 7);
|
drawCircle(515, 1, 0, 7);
|
||||||
showCase(5);
|
showCase(5);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user