mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Simplify a bit pagination code.
This commit is contained in:
parent
c90a62ea13
commit
18e6ec9f02
1 changed files with 3 additions and 11 deletions
|
|
@ -177,21 +177,13 @@ class Writer(object):
|
|||
localcontext['output_file'] = name
|
||||
localcontext.update(kwargs)
|
||||
|
||||
# check paginated
|
||||
paginated = paginated or {}
|
||||
# pagination
|
||||
if paginated:
|
||||
name_root = os.path.splitext(name)[0]
|
||||
|
||||
# pagination needed, init paginators
|
||||
paginators = {}
|
||||
for key in paginated.keys():
|
||||
object_list = paginated[key]
|
||||
|
||||
paginators[key] = Paginator(
|
||||
name_root,
|
||||
object_list,
|
||||
self.settings,
|
||||
)
|
||||
paginators = {key: Paginator(name_root, val, self.settings)
|
||||
for key, val in paginated.items()}
|
||||
|
||||
# generated pages, and write
|
||||
for page_num in range(list(paginators.values())[0].num_pages):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue