# 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
self.multiple_paginations = multiple_paginations
def render(self, context):
- if self.multiple_paginations or context.has_key('paginator'):
+ if self.multiple_paginations or "paginator" in context:
page_suffix = '_%s' % self.queryset_var
else:
page_suffix = ''
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 ' +