Import TOKEN_BLOCK from django.template.base if Django version is greater than or...
[django-pagination.git] / linaro_django_pagination / templatetags / pagination_tags.py
index 995edc3..da22e95 100644 (file)
@@ -37,11 +37,16 @@ from django.template import (
     Context,
     Library,
     Node,
-    TOKEN_BLOCK,
     TemplateSyntaxError,
     Variable,
     loader,
 )
+
+try:
+    from django.template.base import TOKEN_BLOCK
+except ImportError:     # Django < 1.8
+    from django.template import TOKEN_BLOCK
+
 from django.template.loader import select_template
 from django.utils.text import unescape_string_literal
 
@@ -329,9 +334,7 @@ def paginate(context, window=DEFAULT_WINDOW, margin=DEFAULT_MARGIN):
                 new_context['getvars'] = ''
         return new_context
     except (KeyError, AttributeError):
-        pass
-
-    return context
+        return {}
 
 
 register = Library()