Unescape Zephyr content before wrapping.

Now we no longer have weird wrapping based on the length of escaped lines.

(imported from commit fa2c9bc0903e22858acc2af4cd6be34e28ea25db)
This commit is contained in:
Luke Faraone 2012-10-02 15:20:09 -04:00
parent 33ad7817a4
commit 4dcde9b11a
1 changed files with 5 additions and 2 deletions

View File

@ -260,9 +260,12 @@ def send_zephyr(message):
if ' dot ' in zsig: if ' dot ' in zsig:
print "ERROR! Couldn't compute zsig for %s!" % (message["sender_email"]) print "ERROR! Couldn't compute zsig for %s!" % (message["sender_email"])
return return
content = message["content"]
cleaned_content = content.replace('&lt;','<').replace('&gt;','>').replace('&amp;', '&')
wrapped_content = "\n".join("\n".join(textwrap.wrap(line)) wrapped_content = "\n".join("\n".join(textwrap.wrap(line))
for line in message["content"].split("\n")) for line in cleaned_content.split("\n"))
wrapped_content = wrapped_content.replace('&lt;','<').replace('&gt;','>').replace('&amp;', '&')
print "Sending message from %s humbug=>zephyr at %s" % (message["sender_email"], datetime.datetime.now()) print "Sending message from %s humbug=>zephyr at %s" % (message["sender_email"], datetime.datetime.now())
if message['type'] == "class": if message['type'] == "class":
zeph = zephyr.ZNotice(sender=message["sender_email"].replace("mit.edu", "ATHENA.MIT.EDU"), zeph = zephyr.ZNotice(sender=message["sender_email"].replace("mit.edu", "ATHENA.MIT.EDU"),