def paginate_queryset(self, queryset, request_data):
        paginator = self.get_paginator(queryset)
        page_kwarg = self.page_kwarg
        page = request_data.get(page_kwarg, 1)
        try:
            page_number = int(page)
        except ValueError:
            if page == 'last':
                page_number = paginator.num_pages
            else:
                raise InvalidPage(_(
                    "Page is not 'last', nor can it be converted to an int."))
        # This can also raise an InvalidPage exception.
        return paginator, paginator.page(page_number)
Attempt to render a template. We use a try/catch here to avoid having to
dataset/ETHPy150Open django-oscar/django-oscar/src/oscar/apps/search/search_handlers.py/SearchHandler.paginate_queryset--crossover with--dataset/ETHPy150Open nickjj/build-a-saas-app-with-flask/catwatch/lib/flask_mailplus.py/_try_renderer_template