Commit 16a7e6fe authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

do not raise an exception if a user input negative value or non-number string as a page number.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26862 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c7715c8a
...@@ -677,10 +677,13 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -677,10 +677,13 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
lines = int(params.get('list_lines', 0)) lines = int(params.get('list_lines', 0))
form = REQUEST.form form = REQUEST.form
if form.has_key('page_start'): if form.has_key('page_start'):
list_start = (int(form.pop('page_start', 0)) - 1) * lines try:
list_start = (int(form.pop('page_start', 0)) - 1) * lines
except ValueError:
list_start = 0
else: else:
list_start = int(form.pop('list_start', 0)) list_start = int(form.pop('list_start', 0))
params['list_start'] = list_start + lines params['list_start'] = max(list_start + lines, 0)
selection.edit(params=params) selection.edit(params=params)
self.uncheckAll(list_selection_name, listbox_uid) self.uncheckAll(list_selection_name, listbox_uid)
return self.checkAll(list_selection_name, uids, REQUEST=REQUEST) return self.checkAll(list_selection_name, uids, REQUEST=REQUEST)
...@@ -697,7 +700,10 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -697,7 +700,10 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
lines = int(params.get('list_lines', 0)) lines = int(params.get('list_lines', 0))
form = REQUEST.form form = REQUEST.form
if form.has_key('page_start'): if form.has_key('page_start'):
list_start = (int(form.pop('page_start', 0)) - 1) * lines try:
list_start = (int(form.pop('page_start', 0)) - 1) * lines
except ValueError:
list_start = 0
else: else:
list_start = int(form.pop('list_start', 0)) list_start = int(form.pop('list_start', 0))
params['list_start'] = max(list_start - lines, 0) params['list_start'] = max(list_start - lines, 0)
...@@ -717,10 +723,13 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -717,10 +723,13 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
lines = int(params.get('list_lines', 0)) lines = int(params.get('list_lines', 0))
form = REQUEST.form form = REQUEST.form
if form.has_key('page_start'): if form.has_key('page_start'):
list_start = (int(form.pop('page_start', 0)) - 1) * lines try:
list_start = (int(form.pop('page_start', 0)) - 1) * lines
except ValueError:
list_start = 0
else: else:
list_start = int(form.pop('list_start', 0)) list_start = int(form.pop('list_start', 0))
params['list_start'] = list_start params['list_start'] = max(list_start, 0)
selection.edit(params=params) selection.edit(params=params)
self.uncheckAll(list_selection_name, listbox_uid) self.uncheckAll(list_selection_name, listbox_uid)
return self.checkAll(list_selection_name, uids, REQUEST=REQUEST, query_string=query_string) return self.checkAll(list_selection_name, uids, REQUEST=REQUEST, query_string=query_string)
......
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