pep 8
This commit is contained in:
parent
5e87149877
commit
6ad5d4e6cb
@ -8,7 +8,7 @@ import collections
|
|||||||
import hashlib # libravatar
|
import hashlib # libravatar
|
||||||
|
|
||||||
import pelican.signals as signals
|
import pelican.signals as signals
|
||||||
import pelican.generators as generators
|
# import pelican.generators as generators
|
||||||
import pelican.readers as readers
|
import pelican.readers as readers
|
||||||
|
|
||||||
from pelican.contents import Content
|
from pelican.contents import Content
|
||||||
@ -87,12 +87,13 @@ class CommentReader(object):
|
|||||||
(comment_filename, ))
|
(comment_filename, ))
|
||||||
self._comments[comment.metadata['post_id']].append(comment)
|
self._comments[comment.metadata['post_id']].append(comment)
|
||||||
|
|
||||||
# Libravatar
|
# LibreAvatar
|
||||||
|
librevatar_url = 'https://cdn.libravatar.org/avatar'
|
||||||
# Check the presence of the Email header
|
# Check the presence of the Email header
|
||||||
if 'email' in comment.metadata:
|
if 'email' in comment.metadata:
|
||||||
email = comment.metadata['email'].encode('utf-8')
|
email = comment.metadata['email'].encode('utf-8')
|
||||||
ehash = hashlib.md5(email.strip().lower()).hexdigest()
|
ehash = hashlib.md5(email.strip().lower()).hexdigest()
|
||||||
comment.avatar = "https://cdn.libravatar.org/avatar/%s" % (ehash)
|
comment.avatar = "%s/%s" % (librevatar_url, ehash)
|
||||||
else:
|
else:
|
||||||
raise Exception("comment %s does not have a email" %
|
raise Exception("comment %s does not have a email" %
|
||||||
(comment_filename))
|
(comment_filename))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user