Permalink
Browse files

Expose current page number during pagination.

  • Loading branch information...
1 parent 2c0fbbd commit d79479f3719136a4c62337912bebd8c2d5f59a78 @geekman geekman committed Dec 20, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 acrylamid/views/__init__.py
@@ -268,6 +268,8 @@ def init(self, *args, **kwargs):
if 'pagination' not in kwargs:
self.pagination = self.path + ':num/'
+ self.export.append('curr_page')
+
def generate(self, conf, env, data, **kwargs):
if self.pagination is None:
@@ -283,6 +285,8 @@ def generate(self, conf, env, data, **kwargs):
for (next, curr, prev), entrylist, modified in paginator:
+ curr_page = curr
+
next = None if next is None \
else link(u'Next', expand(self.path, kwargs)) if next == 1 \
else link(u'Next', expand(self.pagination, union({'num': next}, kwargs)))

0 comments on commit d79479f

Please sign in to comment.