Check the presence of the Email header

This commit is contained in:
Jesús 2019-11-18 23:52:13 -05:00
parent cb435f9750
commit a6be1e73b8
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -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()