use english text for mail notifications

This commit is contained in:
Martin Zimmermann 2013-11-17 15:44:40 +01:00
parent 97cc894d8c
commit 17aa3e6fc5

View File

@ -2,6 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import io
import time import time
import json import json
@ -72,31 +73,36 @@ class SMTP(object):
def format(self, thread, comment): def format(self, thread, comment):
permalink = local("origin") + thread["uri"] + "#isso-%i" % comment["id"]
rv = [] rv = io.StringIO()
rv.append("%s schrieb:" % (comment["author"] or "Jemand"))
rv.append("") author = comment["author"] or "Anonymous"
rv.append(comment["text"]) if comment["email"]:
rv.append("") author += " <%s>" % comment["email"]
rv.write(author + " wrote:\n")
rv.write("\n")
rv.write(comment["text"] + "\n")
rv.write("\n")
if comment["website"]: if comment["website"]:
rv.append("Webseite des Kommentators: %s" % comment["website"]) rv.write("User's URL: %s\n" % comment["website"])
rv.append("IP Adresse: %s" % comment["remote_addr"]) rv.write("IP address: %s\n" % comment["remote_addr"])
rv.append("Link zum Kommentar: %s" % permalink) rv.write("Link to comment: %s\n" % (local("origin") + thread["uri"] + "#isso-%i" % comment["id"]))
rv.append("") rv.write("\n")
uri = local("host") + "/id/%i" % comment["id"] uri = local("host") + "/id/%i" % comment["id"]
key = self.isso.sign(comment["id"]) key = self.isso.sign(comment["id"])
rv.append("---") rv.write("---\n")
rv.append("Kommentar löschen: %s" % uri + "/delete/" + key) rv.write("Kommentar löschen: %s\n" % (uri + "/delete/" + key))
if comment["mode"] == 2: if comment["mode"] == 2:
rv.append("Kommentar freischalten: %s" % uri + "/activate/" + key) rv.write("Kommentar freischalten: %s\n" % (uri + "/activate/" + key))
return u'\n'.join(rv) rv.seek(0)
return rv.read()
def notify(self, thread, comment): def notify(self, thread, comment):