This commit is contained in:
Jesús
2020-02-25 12:57:22 -05:00
parent a1dd60961f
commit a8cc611240
9 changed files with 74 additions and 46 deletions

View File

@@ -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.