forked from github/pelican
Modernize code base to Python 3+ syntax
Replaces syntax that was relevant in earlier Python versions but that now has modernized equivalents.
This commit is contained in:
parent
2cd1d44576
commit
d43b786b30
37 changed files with 104 additions and 171 deletions
|
|
@ -1,5 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import functools
|
||||
import logging
|
||||
import os
|
||||
|
|
@ -13,7 +11,7 @@ PaginationRule = namedtuple(
|
|||
)
|
||||
|
||||
|
||||
class Paginator(object):
|
||||
class Paginator:
|
||||
def __init__(self, name, url, object_list, settings, per_page=None):
|
||||
self.name = name
|
||||
self.url = url
|
||||
|
|
@ -61,7 +59,7 @@ class Paginator(object):
|
|||
page_range = property(_get_page_range)
|
||||
|
||||
|
||||
class Page(object):
|
||||
class Page:
|
||||
def __init__(self, name, url, object_list, number, paginator, settings):
|
||||
self.full_name = name
|
||||
self.name, self.extension = os.path.splitext(name)
|
||||
|
|
@ -74,7 +72,7 @@ class Page(object):
|
|||
self.settings = settings
|
||||
|
||||
def __repr__(self):
|
||||
return '<Page %s of %s>' % (self.number, self.paginator.num_pages)
|
||||
return '<Page {} of {}>'.format(self.number, self.paginator.num_pages)
|
||||
|
||||
def has_next(self):
|
||||
return self.number < self.paginator.num_pages
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue