add request back from context and fix error handling
authorJustin Quick <justquick@gmail.com>
Tue, 20 Jul 2010 18:57:11 +0000 (14:57 -0400)
committerJustin Quick <justquick@gmail.com>
Tue, 20 Jul 2010 18:57:11 +0000 (14:57 -0400)
pagination/templatetags/pagination_tags.py

index ae843b1..dd338a2 100644 (file)
@@ -214,6 +214,7 @@ def paginate(context, window=DEFAULT_WINDOW, hashtag=''):
             'is_paginated': paginator.count > paginator.per_page,
         }
         if 'request' in context:
             'is_paginated': paginator.count > paginator.per_page,
         }
         if 'request' in context:
+            to_return['request'] = context['request']
             getvars = context['request'].GET.copy()
             if 'page' in getvars:
                 del getvars['page']
             getvars = context['request'].GET.copy()
             if 'page' in getvars:
                 del getvars['page']
@@ -222,7 +223,7 @@ def paginate(context, window=DEFAULT_WINDOW, hashtag=''):
             else:
                 to_return['getvars'] = ''
         return to_return
             else:
                 to_return['getvars'] = ''
         return to_return
-    except KeyError, AttributeError:
+    except (KeyError, AttributeError):
         return {}
 
 register.inclusion_tag('pagination/pagination.html', takes_context=True)(
         return {}
 
 register.inclusion_tag('pagination/pagination.html', takes_context=True)(