Check the presence of the Email header
This commit is contained in:
parent
cb435f9750
commit
a6be1e73b8
@ -76,16 +76,19 @@ class CommentReader(object):
|
|||||||
context=generator.context)
|
context=generator.context)
|
||||||
|
|
||||||
if 'post_id' not in comment.metadata:
|
if 'post_id' not in comment.metadata:
|
||||||
raise Exception("comment %s does not have a post_id" % (
|
raise Exception("comment %s does not have a post_id" %
|
||||||
comment_filename, ))
|
(comment_filename, ))
|
||||||
self._comments[comment.metadata['post_id']].append(comment)
|
self._comments[comment.metadata['post_id']].append(comment)
|
||||||
|
|
||||||
"""
|
# Libravatar
|
||||||
libravatar
|
# Check the presence of the Email header
|
||||||
"""
|
if 'email' in comment.metadata:
|
||||||
email = comment.metadata['email'].encode('utf-8')
|
email = comment.metadata['email'].encode('utf-8')
|
||||||
ahash = hashlib.md5(email.strip().lower()).hexdigest()
|
ehash = hashlib.md5(email.strip().lower()).hexdigest()
|
||||||
comment.avatar = "https://cdn.libravatar.org/avatar/%s" % (ahash)
|
comment.avatar = "https://cdn.libravatar.org/avatar/%s" % (ehash)
|
||||||
|
else:
|
||||||
|
raise Exception("comment %s does not have a email" %
|
||||||
|
(comment_filename))
|
||||||
|
|
||||||
for slug, comments in self._comments.items():
|
for slug, comments in self._comments.items():
|
||||||
comments.sort()
|
comments.sort()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user