#!/usr/bin/python3
from collections import namedtuple
import datetime
+import hashlib
import mimetypes
import os
import re
timestamp = f.readline().strip()
commentbody = makeParas(map(str.strip, f.readlines()))
m = hashlib.md5()
- m.update(emailline.lower())
+ m.update(emailline.lower().encode('utf-8'))
gravatar = "http://www.gravatar.com/avatar/%s?s=48&d=identicon" % str(m.hexdigest())
#timestamp = datetime.datetime.fromtimestamp(os.stat(filepath).st_mtime).isoformat()
return (nameline, emailline, websiteline, commentbody, timestamp, gravatar)
"""
def render_comments(comments):
+ if len(comments) == 0:
+ return ""
rendered_comments = []
for comment in comments:
name = comment[0]
rendered_paras
])
rendered_comments.append(rendered_comment)
- else:
- return ""
return "\n".join([
"<hr><h3>Comments:</h3>",
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<title>Shortlog - a log of everyday things</title>
-<link rel="stylesheet" type="text/css" href="/static/style.css">
+<link rel="stylesheet" type="text/css" href="/shortlog/static/style.css">
<link rel="alternate" type="application/atom+xml" href="/shortlog/feed">
</head>
<body>