]> git.openstreetmap.org Git - osqa.git/commitdiff
Solves several email encoding issues.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 3 Jun 2010 17:08:07 +0000 (17:08 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 3 Jun 2010 17:08:07 +0000 (17:08 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@362 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/skins/default/templates/notifications/answeraccepted.html
forum/skins/default/templates/notifications/newanswer.html
forum/skins/default/templates/notifications/newcomment.html
forum/utils/html.py
forum/utils/mail.py

index 8dac6ce21ff583c0aa77a289fddb9307e303a23d..7170a5ddcf9a3c2e2d48a89a99066bc6aeff50c0 100644 (file)
@@ -5,7 +5,7 @@
     app_name = settings.APP_SHORT_NAME
     answer_author = answer.author.username
     question = answer.question
-    question_title = question.title
+    question_title = html.mark_safe(question.title)
     accepted_by = answer.nstate.accepted.by.username
 {% enddeclare %}
 
index d258cde796814738d585b1afa57705b60c438c1a..947de0ca513dee5c8073b9c2c58a5b73f31abea4 100644 (file)
@@ -5,7 +5,7 @@
     app_name = settings.APP_SHORT_NAME
     answer_author = answer.author.username
     question = answer.question
-    question_title = question.title
+    question_title = html.mark_safe(question.title)
     safe_body = html.html2text(answer.html)
 {% enddeclare %}
 
index a4859a47ec2a3a27812ea69c4c185fdc7e6717e7..043a24d9dfffb3237ab6a6b145fe2b89777ade81 100644 (file)
@@ -8,7 +8,7 @@
     post_author = post.author.username
     comment_author = comment.author
     question_url = question.get_absolute_url()
-    question_title = question.title
+    question_title = html.mark_safe(question.title)
     safe_body = html.html2text(comment.comment)
 {% enddeclare %}
 
index 16d5ac66bf7aa7a7ca12b86e055e87878ec85613..e7ca42c8f4dda569f47813ebdf0f0b61753e5a40 100644 (file)
@@ -55,7 +55,7 @@ def html2text(s, ignore_tags=(), indent_width=4, page_width=80):
     parser.feed(s)
     parser.close()
     parser.generate()
-    return parser.result
+    return mark_safe(parser.result)
 
 def buildtag(name, content, **attrs):
     return mark_safe('<%s %s>%s</a>' % (name, " ".join('%s="%s"' % i for i in attrs.items()), content))
index 7e4beab01bbe814314155ae308c1a2e239b3bbe5..6536a44f9f86813f197012ce3195a072867a3b13 100644 (file)
@@ -158,7 +158,7 @@ def create_and_send_mail_messages(messages):
 
         for recipient, subject, html, text, media in messages:
             msgRoot = MIMEMultipart('related')
-            msgRoot.set_charset('utf-8')
+            #msgRoot.set_charset('utf-8')
             msgRoot['Subject'] = subject
             msgRoot['From'] = sender
             msgRoot['To'] =  '%s <%s>' % (recipient.username, recipient.email)
@@ -167,8 +167,8 @@ def create_and_send_mail_messages(messages):
             msgAlternative = MIMEMultipart('alternative')
             msgRoot.attach(msgAlternative)
 
-            msgAlternative.attach(MIMEText(text))
-            msgAlternative.attach(MIMEText(html, 'html'))
+            msgAlternative.attach(MIMEText(text.encode('utf-8'), _charset='utf-8'))
+            msgAlternative.attach(MIMEText(html.encode('utf-8'), 'html', _charset='utf-8'))
 
             for alias, location in media.items():
                 fp = open(location, 'rb')