git-svn-id: https://django-pagination.googlecode.com/svn/trunk@50
7f1efe38-554e-0410-b69d-
834cb44da2d5
DEFAULT_PAGINATION = getattr(settings, 'PAGINATION_DEFAULT_PAGINATION', 20)
DEFAULT_WINDOW = getattr(settings, 'PAGINATION_DEFAULT_WINDOW', 4)
DEFAULT_ORPHANS = getattr(settings, 'PAGINATION_DEFAULT_ORPHANS', 0)
DEFAULT_PAGINATION = getattr(settings, 'PAGINATION_DEFAULT_PAGINATION', 20)
DEFAULT_WINDOW = getattr(settings, 'PAGINATION_DEFAULT_WINDOW', 4)
DEFAULT_ORPHANS = getattr(settings, 'PAGINATION_DEFAULT_ORPHANS', 0)
-INVALID_PAGE_RAISES_404 = getattr(settings, 'PAGINATION_INVALID_PAGE_RAISES_404',
- False)
+INVALID_PAGE_RAISES_404 = getattr(settings,
+ 'PAGINATION_INVALID_PAGE_RAISES_404', False)
def do_autopaginate(parser, token):
"""
def do_autopaginate(parser, token):
"""
try:
context_var = split[as_index + 1]
except IndexError:
try:
context_var = split[as_index + 1]
except IndexError:
- raise template.TemplateSyntaxError("Context variable assignment " +\
- "must take the form of {%% %r object.example_set.all ... as " +\
+ raise template.TemplateSyntaxError("Context variable assignment " +
+ "must take the form of {%% %r object.example_set.all ... as " +
"context_var_name %%}" % split[0])
del split[as_index:as_index + 2]
if len(split) == 2:
"context_var_name %%}" % split[0])
del split[as_index:as_index + 2]
if len(split) == 2:
try:
orphans = int(split[3])
except ValueError:
try:
orphans = int(split[3])
except ValueError:
- raise template.TemplateSyntaxError(u'Got %s, but expected integer.' % split[3])
+ raise template.TemplateSyntaxError(u'Got %s, but expected integer.'
+ % split[3])
return AutoPaginateNode(split[1], paginate_by=split[2], orphans=orphans,
context_var=context_var)
else:
return AutoPaginateNode(split[1], paginate_by=split[2], orphans=orphans,
context_var=context_var)
else:
- raise template.TemplateSyntaxError('%r tag takes one required ' + \
+ raise template.TemplateSyntaxError('%r tag takes one required ' +
'argument and one optional argument' % split[0])
class AutoPaginateNode(template.Node):
'argument and one optional argument' % split[0])
class AutoPaginateNode(template.Node):
return to_return
except KeyError, AttributeError:
return {}
return to_return
except KeyError, AttributeError:
return {}
-register.inclusion_tag('pagination/pagination.html', takes_context=True)(paginate)
+
+register.inclusion_tag('pagination/pagination.html', takes_context=True)(
+ paginate)
register.tag('autopaginate', do_autopaginate)
register.tag('autopaginate', do_autopaginate)