X-Git-Url: https://git.mdrn.pl/django-pagination.git/blobdiff_plain/23e5d7444618141cdb74251ed5c36da6b3887a1a..c8a9f4983b1e6247bbb17d69257f144fafb4e646:/linaro_django_pagination/templatetags/pagination_tags.py diff --git a/linaro_django_pagination/templatetags/pagination_tags.py b/linaro_django_pagination/templatetags/pagination_tags.py index 05c44f3..1da25f4 100644 --- a/linaro_django_pagination/templatetags/pagination_tags.py +++ b/linaro_django_pagination/templatetags/pagination_tags.py @@ -1,5 +1,5 @@ # Copyright (c) 2008, Eric Florenzano -# Copyright (C) 2010, 2011 Linaro Limited +# Copyright (c) 2010, 2011 Linaro Limited # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -144,7 +144,13 @@ class AutoPaginateNode(template.Node): orphans = self.orphans.resolve(context) paginator = Paginator(value, paginate_by, orphans) try: - page_obj = paginator.page(context['request'].page(page_suffix)) + request = context['request'] + except KeyError: + raise ImproperlyConfigured( + "You need to enable 'django.core.context_processors.request'." + " See linaro-django-pagination/README file for TEMPLATE_CONTEXT_PROCESSORS details") + try: + page_obj = paginator.page(request.page(page_suffix)) except InvalidPage: if INVALID_PAGE_RAISES_404: raise Http404('Invalid page requested. If DEBUG were set to ' +