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)
|
||||
|
||||
if 'post_id' not in comment.metadata:
|
||||
raise Exception("comment %s does not have a post_id" % (
|
||||
comment_filename, ))
|
||||
raise Exception("comment %s does not have a post_id" %
|
||||
(comment_filename, ))
|
||||
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')
|
||||
ahash = hashlib.md5(email.strip().lower()).hexdigest()
|
||||
comment.avatar = "https://cdn.libravatar.org/avatar/%s" % (ahash)
|
||||
ehash = hashlib.md5(email.strip().lower()).hexdigest()
|
||||
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():
|
||||
comments.sort()
|
||||
|
Loading…
x
Reference in New Issue
Block a user