﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7307	Pagination: Give the InvalidPage exception an attribute storing the converted integer number	miracle2k	nobody	"This truly is a tiny issue, but when subclassing Paginator, if you override page(), there are different things that can happen:
 
 1. Page number is valid, you get a Page object.
 1. Page number is out of range, InvalidPage is raised
 1. Page number is not a number, InvalidPage is raised

In your child class, you cannot differ between 1) and 2/3), so if you want to work with ""number"" afterwards, you once again need to check it's an int, and raise the appropriate exceptions if not.

Suggestioned solution: Give the InvalidPage exception a number field that is set whenever the number was successfully converted to an integer.

Example:

{{{
class MyPaginator(Pagintor):
   def page(self, number):
      try:
          super(MyPaginator, self).page(number)
      except InvalidPage, e:
          # using ""number"" here is problematic - it might be a string
          if e.number > self.num_pages:
             # ...
}}}"		closed	Core (Other)	dev		fixed			Unreviewed	0	0	0	0	0	0
