def validate_number(self, number):
        "Validates the given 1-based page number."
        try:
            number = int(number)
        except (__HOLE__, ValueError):
            raise PageNotAnInteger('That page number is not an integer')
        if number < 1:
            raise EmptyPage('That page number is less than 1')
        if number > self.num_pages:
            if number == 1 and self.allow_empty_first_page:
                pass
            else:
                raise EmptyPage('That page contains no results')
        return number
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/core/paginator.py/Paginator.validate_number