From: Markus Törnqvist Date: Wed, 26 Jun 2013 12:38:05 +0000 (+0300) Subject: Context is updated, return it. Also avoid recursion error. X-Git-Tag: release-2.1~7^2~3 X-Git-Url: https://git.mdrn.pl/django-pagination.git/commitdiff_plain/12fa5deb8220b12e21b44524751cc515796bf219?ds=inline;hp=0ccb6d768f13d18f244580113a68ac117c2fc71f Context is updated, return it. Also avoid recursion error. --- diff --git a/linaro_django_pagination/templatetags/pagination_tags.py b/linaro_django_pagination/templatetags/pagination_tags.py index a4e4fed..1577452 100644 --- a/linaro_django_pagination/templatetags/pagination_tags.py +++ b/linaro_django_pagination/templatetags/pagination_tags.py @@ -186,7 +186,7 @@ class PaginateNode(Node): new_context = paginate(context) if self.template: template_list.insert(0, self.template) - return loader.render_to_string(template_list, new_context, + return loader.render_to_string(template_list, new_context, context_instance = context) @@ -326,12 +326,11 @@ def paginate(context, window=DEFAULT_WINDOW, margin=DEFAULT_MARGIN): new_context['getvars'] = "&%s" % getvars.urlencode() else: new_context['getvars'] = '' - except (KeyError, AttributeError): - new_context = {} - context.update(new_context) + context.update(new_context) - return context + except (KeyError, AttributeError): + pass register = Library()