Commit bd4fde9e authored by Ozzie Isaacs's avatar Ozzie Isaacs

Fix #1992 handle invalid numbers of books seriesindex

parent c85cfa90
......@@ -439,6 +439,9 @@ def edit_book_series_index(series_index, book):
# Add default series_index to book
modif_date = False
series_index = series_index or '1'
if not series_index.replace('.', '', 1).isdigit():
flash(_("%(seriesindex)s is not a valid number, skipping", seriesindex=series_index), category="warning")
return False
if book.series_index != series_index:
book.series_index = series_index
modif_date = True
......
......@@ -122,10 +122,13 @@ def formatfloat(value, decimals=1):
@jinjia.app_template_filter('formatseriesindex')
def formatseriesindex_filter(series_index):
if series_index:
try:
if int(series_index) - series_index == 0:
return int(series_index)
else:
return series_index
except ValueError:
return series_index
return 0
@jinjia.app_template_filter('uuidfilter')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment