pep8
This commit is contained in:
@@ -14,23 +14,29 @@ import pelican.readers as readers
|
||||
from pelican.contents import Content
|
||||
|
||||
|
||||
# Python 3 __cmp__ compatibility mixin from https://stackoverflow.com/a/39166382/807307
|
||||
# Python 3 compatibility mixin from https://stackoverflow.com/a/39166382/807307
|
||||
PY3 = sys.version_info[0] >= 3
|
||||
if PY3:
|
||||
def cmp(a, b):
|
||||
return (a > b) - (a < b)
|
||||
# mixin class for Python3 supporting __cmp__
|
||||
|
||||
class PY3__cmp__:
|
||||
def __eq__(self, other):
|
||||
return self.__cmp__(other) == 0
|
||||
|
||||
def __ne__(self, other):
|
||||
return self.__cmp__(other) != 0
|
||||
|
||||
def __gt__(self, other):
|
||||
return self.__cmp__(other) > 0
|
||||
|
||||
def __lt__(self, other):
|
||||
return self.__cmp__(other) < 0
|
||||
|
||||
def __ge__(self, other):
|
||||
return self.__cmp__(other) >= 0
|
||||
|
||||
def __le__(self, other):
|
||||
return self.__cmp__(other) <= 0
|
||||
else:
|
||||
@@ -40,7 +46,8 @@ else:
|
||||
|
||||
class Comment(Content, PY3__cmp__):
|
||||
mandatory_properties = ('post_id', 'author')
|
||||
default_template = 'comment' # this is required, but not used
|
||||
# this is required, but not used
|
||||
default_template = 'comment'
|
||||
default_status = 'published'
|
||||
|
||||
def __cmp__(self, other):
|
||||
@@ -98,6 +105,7 @@ class CommentReader(object):
|
||||
def get_comments(self, slug):
|
||||
return self._comments[slug]
|
||||
|
||||
|
||||
def comment_initialization(generator):
|
||||
"""
|
||||
Set up the comment plugin.
|
||||
|
||||
Reference in New Issue
Block a user