Skip to content

Commit f28241c

Browse files
author
Richard Jones
committed
handle bogus pagination values (issue 2550530)
1 parent 6733fce commit f28241c

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ are given with the most recent entry first.
66
Fixes:
77
- bug introduced into CVS export and view
88
- bugs introduced in the migration to the email package (issue 2550531)
9+
- handle bogus pagination values (issue 2550530)
910

1011

1112
2009-03-13 1.4.7 (r4202)

roundup/cgi/templating.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ def renderQueryForm(self):
11311131
# The context for a search page should be the class, not any
11321132
# node.
11331133
self._client.nodeid = None
1134-
1134+
11351135
# use our fabricated request
11361136
return pt.render(self._client, req.classname, req)
11371137

@@ -1959,7 +1959,7 @@ def menu(self, size=None, height=None, showid=0, additional=[], value=None,
19591959
else:
19601960
fn = lambda optionid: linkcl.get(optionid, propname)
19611961
additional_fns.append(fn)
1962-
1962+
19631963
for optionid in options:
19641964
# get the option value, and if it's None use an empty string
19651965
option = linkcl.get(optionid, k) or ''
@@ -2147,7 +2147,7 @@ def menu(self, size=None, height=None, showid=0, additional=[],
21472147
for opt in linkcl.filter(None, conditions, sort_on)
21482148
if self._db.security.hasPermission("View", self._client.userid,
21492149
linkcl.classname, itemid=opt)]
2150-
2150+
21512151
# make sure we list the current values if they're retired
21522152
for val in value:
21532153
if val not in options:
@@ -2180,7 +2180,7 @@ def menu(self, size=None, height=None, showid=0, additional=[],
21802180
else:
21812181
fn = lambda optionid: linkcl.get(optionid, propname)
21822182
additional_fns.append(fn)
2183-
2183+
21842184
for optionid in options:
21852185
# get the option value, and if it's None use an empty string
21862186
option = linkcl.get(optionid, k) or ''
@@ -2399,13 +2399,21 @@ def _post_init(self):
23992399
for name in ':pagesize @pagesize'.split():
24002400
if self.form.has_key(name):
24012401
self.special_char = name[0]
2402-
self.pagesize = int(self.form.getfirst(name))
2402+
try:
2403+
self.pagesize = int(self.form.getfirst(name))
2404+
except ValueError:
2405+
# not an integer - ignore
2406+
pass
24032407

24042408
self.startwith = 0
24052409
for name in ':startwith @startwith'.split():
24062410
if self.form.has_key(name):
24072411
self.special_char = name[0]
2408-
self.startwith = int(self.form.getfirst(name))
2412+
try:
2413+
self.startwith = int(self.form.getfirst(name))
2414+
except ValueError:
2415+
# not an integer - ignore
2416+
pass
24092417

24102418
# dispname
24112419
if self.form.has_key('@dispname'):

0 commit comments

Comments
 (0)