summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-09-20 15:45:32 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2012-09-20 15:45:32 -0400
commit5ac09a8bae3b095bd268866285e8a0a5bd35aa51 (patch)
treeaa0d06671ba727a8a5aed9b98db9125e4d7630c5
parente3be690632c19c3f6f921d97be6cd5f36e9040f9 (diff)
parent3703cd088fa958cdd0c117fe0f5f72b594b8e6e8 (diff)
downloadaskbot-5ac09a8bae3b095bd268866285e8a0a5bd35aa51.tar.gz
askbot-5ac09a8bae3b095bd268866285e8a0a5bd35aa51.tar.bz2
askbot-5ac09a8bae3b095bd268866285e8a0a5bd35aa51.zip
merged kp-dev branch
-rw-r--r--askbot/deps/django_authopenid/views.py8
-rw-r--r--askbot/mail/__init__.py9
-rw-r--r--askbot/management/commands/send_accept_answer_reminders.py21
-rw-r--r--askbot/management/commands/send_unanswered_question_reminders.py22
-rw-r--r--askbot/models/__init__.py10
-rw-r--r--askbot/templates/authopenid/email_validation.html20
-rw-r--r--askbot/templates/email/accept_answer_reminder.html14
-rw-r--r--askbot/templates/email/ask_for_signature.html13
-rw-r--r--askbot/templates/email/instant_notification.html (renamed from askbot/templates/instant_notification.html)12
-rw-r--r--askbot/templates/email/insufficient_rep_to_post_by_email.html9
-rw-r--r--askbot/templates/email/notify_author_about_approved_post.html11
-rw-r--r--askbot/templates/email/post_as_subthread.html1
-rw-r--r--askbot/templates/email/re_welcome_lamson_on.html12
-rw-r--r--askbot/templates/email/rejected_post.html12
-rw-r--r--askbot/templates/email/unanswered_question_reminder.html14
-rw-r--r--askbot/tests/email_alert_tests.py30
-rw-r--r--askbot/tests/reply_by_email_tests.py31
-rw-r--r--askbot/views/commands.py20
18 files changed, 168 insertions, 101 deletions
diff --git a/askbot/deps/django_authopenid/views.py b/askbot/deps/django_authopenid/views.py
index 5498c792..e5c7df6c 100644
--- a/askbot/deps/django_authopenid/views.py
+++ b/askbot/deps/django_authopenid/views.py
@@ -46,7 +46,7 @@ from django.utils.encoding import smart_unicode
from django.utils.html import escape
from django.utils.translation import ugettext as _
from django.utils.safestring import mark_safe
-from django.core.mail import send_mail
+from askbot.mail import send_mail
from recaptcha_works.decorators import fix_recaptcha_remote_ip
from askbot.skins.loaders import render_into_skin, get_template
from askbot.deps.django_authopenid.ldap_auth import ldap_create_user
@@ -385,7 +385,7 @@ def signin(request, template_name='authopenid/signin.html'):
user_info = ldap_authenticate(username, password)
if user_info['success']:
if askbot_settings.LDAP_AUTOCREATE_USERS:
- #create new user or
+ #create new user or
user = ldap_create_user(user_info).user
user = authenticate(method='force', user_id=user.id)
assert(user is not None)
@@ -404,7 +404,7 @@ def signin(request, template_name='authopenid/signin.html'):
user_info['last_name']
return finalize_generic_signin(
request,
- login_provider_name = 'ldap',
+ login_provider_name = 'ldap',
user_identifier = ldap_username + '@ldap',
redirect_url = next_url
)
@@ -1179,7 +1179,7 @@ def send_email_key(email, key, handler_url_name='user_account_recover'):
reverse(handler_url_name) +\
'?validation_code=' + key
}
- template = get_template('authopenid/email_validation.txt')
+ template = get_template('authopenid/email_validation.html')
message = template.render(data)
send_mail(subject, message, django_settings.DEFAULT_FROM_EMAIL, [email])
diff --git a/askbot/mail/__init__.py b/askbot/mail/__init__.py
index 739b147e..2d314dbc 100644
--- a/askbot/mail/__init__.py
+++ b/askbot/mail/__init__.py
@@ -158,8 +158,8 @@ def mail_moderators(
try:
msg = mail.EmailMessage(
- subject_line,
- body_text,
+ subject_line,
+ body_text,
from_email,
recipient_list,
headers = headers or {}
@@ -287,10 +287,11 @@ def process_attachment(attachment):
def extract_user_signature(text, reply_code):
"""extracts email signature as text trailing
the reply code"""
- if reply_code in text:
+ striped_text = strip_tags(text)
+ if reply_code in striped_text:
#extract the signature
tail = list()
- for line in reversed(text.splitlines()):
+ for line in reversed(striped_text.splitlines()):
#scan backwards from the end until the magic line
if reply_code in line:
break
diff --git a/askbot/management/commands/send_accept_answer_reminders.py b/askbot/management/commands/send_accept_answer_reminders.py
index 3a20ba27..119d7611 100644
--- a/askbot/management/commands/send_accept_answer_reminders.py
+++ b/askbot/management/commands/send_accept_answer_reminders.py
@@ -8,6 +8,8 @@ from django.utils.translation import ugettext as _
from django.utils.translation import ungettext
from askbot import mail
from askbot.utils.classes import ReminderSchedule
+from askbot.skins.loaders import get_template
+from django.template import Context
DEBUG_THIS_COMMAND = False
@@ -63,16 +65,15 @@ class Command(NoArgsCommand):
reminder_phrase = _('Please accept the best answer for this question:')
else:
reminder_phrase = _('Please accept the best answer for these questions:')
- body_text = '<p>' + reminder_phrase + '</p>'
- body_text += '<ul>'
- for question in final_question_list:
- body_text += '<li><a href="%s%s?sort=latest">%s</a></li>' \
- % (
- askbot_settings.APP_URL,
- question.get_absolute_url(),
- question.thread.title
- )
- body_text += '</ul>'
+
+ data = {
+ 'site_url': askbot_settings.APP_URL,
+ 'questions': final_question_list,
+ 'reminder_phrase': reminder_phrase
+ }
+
+ template = get_template('email/accept_answer_reminder.html')
+ body_text = template.render(Context(data))
if DEBUG_THIS_COMMAND:
print "User: %s<br>\nSubject:%s<br>\nText: %s<br>\n" % \
diff --git a/askbot/management/commands/send_unanswered_question_reminders.py b/askbot/management/commands/send_unanswered_question_reminders.py
index 39402b25..3fa390ad 100644
--- a/askbot/management/commands/send_unanswered_question_reminders.py
+++ b/askbot/management/commands/send_unanswered_question_reminders.py
@@ -6,11 +6,13 @@ from django.utils.translation import ungettext
from askbot import mail
from askbot.utils.classes import ReminderSchedule
from askbot.models.question import Thread
+from askbot.skins.loaders import get_template
+from django.template import Context
DEBUG_THIS_COMMAND = False
class Command(NoArgsCommand):
- """management command that sends reminders
+ """management command that sends reminders
about unanswered questions to all users
"""
def handle_noargs(self, **options):
@@ -69,15 +71,15 @@ class Command(NoArgsCommand):
'topics': tag_summary
}
- body_text = '<ul>'
- for question in final_question_list:
- body_text += '<li><a href="%s%s?sort=latest">%s</a></li>' \
- % (
- askbot_settings.APP_URL,
- question.get_absolute_url(),
- question.thread.title
- )
- body_text += '</ul>'
+ data = {
+ 'site_url': askbot_settings.APP_URL,
+ 'questions': final_question_list,
+ 'subject_line': subject_line
+ }
+
+ template = get_template('email/unanswered_question_reminder.html')
+ body_text = template.render(Context(data))
+
if DEBUG_THIS_COMMAND:
print "User: %s<br>\nSubject:%s<br>\nText: %s<br>\n" % \
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py
index f5e67189..2044dc16 100644
--- a/askbot/models/__init__.py
+++ b/askbot/models/__init__.py
@@ -2266,7 +2266,7 @@ def user_get_group_membership(self, group):
return GroupMembership.objects.get(user=self, group=group)
except GroupMembership.DoesNotExist:
return None
-
+
def user_get_groups_membership_info(self, groups):
"""returns a defaultdict with values that are
@@ -2973,14 +2973,12 @@ def format_instant_notification_email(
'post_url': post_url,
'origin_post_title': origin_post.thread.title,
'user_subscriptions_url': user_subscriptions_url,
- 'reply_separator': reply_separator
+ 'reply_separator': reply_separator,
+ 'reply_address': reply_address
}
subject_line = _('"%(title)s"') % {'title': origin_post.thread.title}
content = template.render(Context(update_data))
- if can_reply:
- content += '<p style="font-size:8px;color:#aaa">' + \
- reply_address + '</p>'
return subject_line, content
@@ -3083,7 +3081,7 @@ def send_instant_notifications_about_activity_in_post(
reply_address = reply_address,
alt_reply_address = alt_reply_address,
update_type = update_type,
- template = get_template('instant_notification.html')
+ template = get_template('email/instant_notification.html')
)
headers['Reply-To'] = reply_address
diff --git a/askbot/templates/authopenid/email_validation.html b/askbot/templates/authopenid/email_validation.html
new file mode 100644
index 00000000..616b285f
--- /dev/null
+++ b/askbot/templates/authopenid/email_validation.html
@@ -0,0 +1,20 @@
+{% extends "email/base_mail.html"%}
+{% block title %}{% trans %}Greetings from the Q&A forum{% endtrans %},{%endblock%}
+{% block headline%}{% trans %}Greetings from the Q&A forum{% endtrans %},{%endblock%}
+
+{%block content%}
+
+<p>{% trans %}To make use of the Forum, please follow the link below:{% endtrans %}</p>
+
+<p><a href="{{validation_link}}" >{{validation_link}}</a></p>
+
+<p>{% trans %}Following the link above will help us verify your email address.{% endtrans %}</p>
+
+<p>{% trans %}If you believe that this message was sent in mistake -
+no further action is needed. Just ignore this email, we apologize
+for any inconvenience{% endtrans %}</p>
+{%endblock%}
+
+{%block footer %}
+{% include "email/footer.html" %}
+{% endblock %}
diff --git a/askbot/templates/email/accept_answer_reminder.html b/askbot/templates/email/accept_answer_reminder.html
new file mode 100644
index 00000000..7b922cd4
--- /dev/null
+++ b/askbot/templates/email/accept_answer_reminder.html
@@ -0,0 +1,14 @@
+{% extends "email/base_mail.html"%}
+{%block title%}{{reminder_phrase}}{% endblock %}
+{%block headline%}{{reminder_phrase}}{% endblock %}
+
+{%block content %}
+<ul>
+ {% for question in questions %}
+ <li><a href="{{site_url}}{{question.get_absolute_url()}}?sort=latest">{{question.thread.title}}</a></li>
+ {% endfor %}
+</ul>
+{% endblock %}
+{%block footer %}
+{% include "email/footer.html" %}
+{% endblock %}
diff --git a/askbot/templates/email/ask_for_signature.html b/askbot/templates/email/ask_for_signature.html
index 93e2fa4b..ee4a1311 100644
--- a/askbot/templates/email/ask_for_signature.html
+++ b/askbot/templates/email/ask_for_signature.html
@@ -1,12 +1,19 @@
+{% extends "email/base_mail.html"%}
{% import "email/macros.html" as macros %}
-<p style="{{ macros.heading_style() }}">
- {% trans user=username|escape %}{{ user }}, please reply to this message.{% endtrans %}
-</p>
+{%block headline%}
+{% trans user=username|escape %}{{ user }}, please reply to this message.{% endtrans %}
+{% endblock %}
+
+{%block content %}
<p>
{% trans %}Your post could not be published, because we could not detect signature in your email.{% endtrans %}<br/>
{% trans %}This happened either because this is your first post or you have changed your email signature.{% endtrans %}<br/>
{% trans %}Please make a simple response, without editing this message.{% endtrans %}<br/>
{% trans %}We will then attempt to detect the signature in your response and you should be able to post.{% endtrans %}
</p>
+{% endblock %}
+
+{%block footer %}
{% include "email/footer.html" %}
<p style="{{ macros.fine_print_style() }}">{{ footer_code }}</p>
+{% endblock %}
diff --git a/askbot/templates/instant_notification.html b/askbot/templates/email/instant_notification.html
index cd6e5427..3e8533b6 100644
--- a/askbot/templates/instant_notification.html
+++ b/askbot/templates/email/instant_notification.html
@@ -1,7 +1,17 @@
+{% extends "email/base_mail.html"%}
+
+{%block content %}
{{ reply_separator }}
<div>{{ content_preview }}</div>
{% trans %}
<p>Please note - you can easily <a href="{{user_subscriptions_url}}">change</a>
how often you receive these notifications or unsubscribe. Thank you for your interest in our forum!</p>
{% endtrans %}
-{% trans %}<p>Sincerely,<br/>Forum Administrator</p>{% endtrans %}
+{%endblock%}
+
+{%block footer %}
+{% include "email/footer.html" %}
+{% if can_reply %}
+<p style="font-size:8px;color:#aaa">{{reply_address}}</p>
+{%endif%}
+{%endblock%}
diff --git a/askbot/templates/email/insufficient_rep_to_post_by_email.html b/askbot/templates/email/insufficient_rep_to_post_by_email.html
index 284cc1b0..a7e88b3b 100644
--- a/askbot/templates/email/insufficient_rep_to_post_by_email.html
+++ b/askbot/templates/email/insufficient_rep_to_post_by_email.html
@@ -1,3 +1,4 @@
+{% extends "email/base_mail.html"%}
{% import "email/macros.html" as macros %}
{# parameters:
* min_upvotes
@@ -5,11 +6,15 @@
* site_name - for the footer
* site_link - html for the link
#}
-<p style="{{ macros.heading_style() }}">
+{%block headline%}
{% trans user=username|escape %}{{ username }}, your question could not be posted by email just yet.{% endtrans %}
-</p>
+{%endblock%}
+{%block content%}
<p>
{% trans %}To make posts by email, you need to receive about {{min_upvotes}} upvotes.{% endtrans %}<br/>
{% trans link=site_link|safe %}At this time, please post your question at {{link}}{% endtrans %}
</p>
+{%endblock%}
+{%block footer}
{% include "email/footer.html" %}
+{%endblock%}
diff --git a/askbot/templates/email/notify_author_about_approved_post.html b/askbot/templates/email/notify_author_about_approved_post.html
index 085141d9..24601775 100644
--- a/askbot/templates/email/notify_author_about_approved_post.html
+++ b/askbot/templates/email/notify_author_about_approved_post.html
@@ -1,3 +1,5 @@
+{% extends "email/base_mail.html"%}
+
{#
parameters:
* reply_separator_line
@@ -6,6 +8,8 @@
* post
* reply_code (comma-separated list of emails to respond to this message)
#}
+
+{%block content %}
{{ reply_separator_line }}
<p>{% trans
post_text = post.text|safe_urlquote,
@@ -18,4 +22,9 @@
<p style="font-size:16px">{{ post.thread.title }}</p>
{% endif %}
{{ post.html }}
-<p style="font-size:8px;color:#aaa;">{{ reply_code }}</p>
+{% endblock %}
+
+{%block footer %}
+{% include "email/footer.html" %}
+<p style="{{ macros.fine_print_style() }}">{{ email_code }}</p>{# important #}
+{% endblock %}
diff --git a/askbot/templates/email/post_as_subthread.html b/askbot/templates/email/post_as_subthread.html
index 9b6eb728..4a4bd047 100644
--- a/askbot/templates/email/post_as_subthread.html
+++ b/askbot/templates/email/post_as_subthread.html
@@ -1,4 +1,5 @@
{% from "email/macros.html" import quoted_post %}
+
{% if post.post_type in ('question', 'answer') %}
{{ quoted_post(post) }}
{% set comments = post.get_cached_comments() %}
diff --git a/askbot/templates/email/re_welcome_lamson_on.html b/askbot/templates/email/re_welcome_lamson_on.html
index 412fede8..d2c7884c 100644
--- a/askbot/templates/email/re_welcome_lamson_on.html
+++ b/askbot/templates/email/re_welcome_lamson_on.html
@@ -1,7 +1,13 @@
-<p style="font-size:16px;font-weight:bold;">
- {% trans %}Great, you are ready to use {{ site_name }}!{% endtrans %}
-</p>
+{% extends "email/base_mail.html"%}
+{% block headline %}{% trans %}Great, you are ready to use {{ site_name }}!{% endtrans %}{%endblock%}
+{% block title %}{% trans %}Great, you are ready to use {{ site_name }}!{% endtrans %}{%endblock%}
+
+{%block content %}
<p>{% trans %}You can post questions by emailing them at {{ ask_address }}.{% endtrans %}</p>
<p>{% trans %}When you receive update notifications, you will be able to respond to them, also by email.{% endtrans %}</p>
<p>{% trans %}Of course, you can always visit the {{ site_name }} at <a href="{{ site_url }}">{{ site_url }}</a>{% endtrans %}</p>
+{%endblock%}
+
+{%block footer%}
{% include "email/footer.html" %}
+{%endblock%}
diff --git a/askbot/templates/email/rejected_post.html b/askbot/templates/email/rejected_post.html
new file mode 100644
index 00000000..7106d37f
--- /dev/null
+++ b/askbot/templates/email/rejected_post.html
@@ -0,0 +1,12 @@
+{% extends "email/base_mail.html"%}
+{%block headline%}{% trans %} Your post was rejected. {% endtrans %}{%endblock%}
+{%block title%}{% trans %} Your post was rejected. {% endtrans %}{%endblock%}
+{%block content %}
+<p>{% trans %}Your post (copied in the end), was rejected for the following reason:{% endtrans %}</p>,
+<p>{{reject_reason|safe}}</p>
+<p>{% trans %}Here is your original post{% endtrans %}</p>
+<p>{{post|safe}}</p>
+{% endblock %}
+{%block footer %}
+{% include "email/footer.html" %}
+{% endblock %}
diff --git a/askbot/templates/email/unanswered_question_reminder.html b/askbot/templates/email/unanswered_question_reminder.html
new file mode 100644
index 00000000..8eaa6f40
--- /dev/null
+++ b/askbot/templates/email/unanswered_question_reminder.html
@@ -0,0 +1,14 @@
+{% extends "email/base_mail.html"%}
+{%block title%}{{subject_line}}{% endblock %}
+{%block headline%}{{subject_line}}{% endblock %}
+
+{%block content %}
+<ul>
+ {% for question in questions %}
+ <li><a href="{{site_url}}{{question.get_absolute_url()}}?sort=latest">{{question.thread.title}}</a></li>
+ {% endfor %}
+</ul>
+{% endblock %}
+{%block footer %}
+{% include "email/footer.html" %}
+{% endblock %}
diff --git a/askbot/tests/email_alert_tests.py b/askbot/tests/email_alert_tests.py
index b377a429..1937da6f 100644
--- a/askbot/tests/email_alert_tests.py
+++ b/askbot/tests/email_alert_tests.py
@@ -39,7 +39,7 @@ def email_alert_test(test_func):
test_object.check_results(test_name)
else:
raise ValueError('test method names must have prefix "test_"')
- return wrapped_test
+ return wrapped_test
def setup_email_alert_tests(setup_func):
@functools.wraps(setup_func)
@@ -107,7 +107,7 @@ class SubjectLineTests(TestCase):
self.assertEquals(subj, 'hahah')
class EmailAlertTests(TestCase):
- """Base class for testing delayed Email notifications
+ """Base class for testing delayed Email notifications
that are triggered by the send_email_alerts
command
@@ -145,7 +145,7 @@ class EmailAlertTests(TestCase):
@setup_email_alert_tests
def setUp(self):
"""generic pre-test setup method:
-
+
this function is empty - because it's intendend content is
entirely defined by the decorator
@@ -157,7 +157,7 @@ class EmailAlertTests(TestCase):
def setUpUsers(self):
self.other_user = utils.create_user(
- username = 'other',
+ username = 'other',
email = 'other@domain.com',
date_joined = self.setup_timestamp,
status = 'm'
@@ -177,8 +177,8 @@ class EmailAlertTests(TestCase):
body_text = 'dummy test comment',
timestamp = None
):
- """posts and returns a comment to parent post, uses
- now timestamp if not given, dummy body_text
+ """posts and returns a comment to parent post, uses
+ now timestamp if not given, dummy body_text
author is required
"""
if timestamp is None:
@@ -211,8 +211,8 @@ class EmailAlertTests(TestCase):
)
def post_question(
- self,
- author = None,
+ self,
+ author = None,
timestamp = None,
title = 'test question title',
body_text = 'test question body',
@@ -234,7 +234,7 @@ class EmailAlertTests(TestCase):
return self.question
def maybe_visit_question(self, user = None):
- """visits question on behalf of a given user and applies
+ """visits question on behalf of a given user and applies
a timestamp set in the class attribute ``visit_timestamp``
if ``visit_timestamp`` is None, then visit is skipped
@@ -298,7 +298,7 @@ class EmailAlertTests(TestCase):
(self.target_user.email, outbox[0].recipients()[0])
#verify that target user receives the email
self.assertEqual(
- outbox[0].recipients()[0],
+ outbox[0].recipients()[0],
self.target_user.email,
error_message
)
@@ -806,7 +806,7 @@ class EmailReminderTestCase(utils.AskbotTestCase):
#frequency_setting_name = 'UNANSWERED_REMINDER_FREQUENCY'
#days_before_setting_name = 'DAYS_BEFORE_SENDING_UNANSWERED_REMINDER'
#max_reminder_setting_name = 'MAX_UNANSWERED_REMINDERS'
-
+
def setUp(self):
self.u1 = self.create_user(username = 'user1')
self.u2 = self.create_user(username = 'user2')
@@ -871,7 +871,7 @@ class AcceptAnswerReminderTests(EmailReminderTestCase):
class UnansweredReminderTests(EmailReminderTestCase):
-
+
enable_setting_name = 'ENABLE_UNANSWERED_REMINDERS'
frequency_setting_name = 'UNANSWERED_REMINDER_FREQUENCY'
days_before_setting_name = 'DAYS_BEFORE_SENDING_UNANSWERED_REMINDER'
@@ -980,7 +980,7 @@ class PostApprovalTests(utils.AskbotTestCase):
self.enable_content_moderation
)
askbot_settings.update(
- 'SELF_NOTIFY_EMAILED_POST_AUTHOR_WHEN',
+ 'SELF_NOTIFY_EMAILED_POST_AUTHOR_WHEN',
self.self_notify_when
)
@@ -1005,10 +1005,10 @@ class PostApprovalTests(utils.AskbotTestCase):
u2.approve_post_revision(question.get_latest_revision())
outbox = django.core.mail.outbox
- self.assertEquals(len(outbox), 2)
+ self.assertEquals(len(outbox), 1)
#moderation notification
self.assertEquals(outbox[0].recipients(), [u1.email,])
- self.assertEquals(outbox[1].recipients(), [u1.email,])#approval
+ #self.assertEquals(outbox[1].recipients(), [u1.email,])#approval
class MailMessagesTests(utils.AskbotTestCase):
diff --git a/askbot/tests/reply_by_email_tests.py b/askbot/tests/reply_by_email_tests.py
index 9248fc50..30cb48be 100644
--- a/askbot/tests/reply_by_email_tests.py
+++ b/askbot/tests/reply_by_email_tests.py
@@ -1,6 +1,7 @@
from django.utils.translation import ugettext as _
from askbot.models import ReplyAddress
from askbot.mail.lamson_handlers import PROCESS, VALIDATE_EMAIL, get_parts
+from askbot.mail import extract_user_signature
from askbot import const
@@ -146,7 +147,6 @@ class EmailSignatureDetectionTests(AskbotTestCase):
def setUp(self):
self.u1 = self.create_user('user1', status = 'a')
self.u2 = self.create_user('user2', status = 'a')
- self.u3 = self.create_user('user3', status = 'a')
def test_detect_signature_in_response(self):
question = self.post_question(user = self.u1)
@@ -193,32 +193,3 @@ class EmailSignatureDetectionTests(AskbotTestCase):
signature = self.reload_object(self.u2).email_signature
self.assertEqual(signature, 'Yours Truly')
-
- def test_detect_signature_in_html_welcome_response(self):
- reply_token = ReplyAddress.objects.create_new(
- user = self.u3,
- reply_action = 'validate_email'
- )
- self.u3.email_signature = ''
- self.u3.save()
- signature = 'Yours Truly'
-
- msg = MockMessage(
- 'some text',
- self.u3.email,
- signature = signature,
- response_code = reply_token.address
- )
-
- html_message = '<b>some text</b>' + signature
-
- msg.attach_alternative(html_message, 'text/html')
- VALIDATE_EMAIL(
- msg,
- address = reply_token.address
- )
-
- signature = self.reload_object(self.u3).email_signature
- self.assertEqual(signature, 'Yours Truly')
-
-
diff --git a/askbot/views/commands.py b/askbot/views/commands.py
index e967a080..2ab15c35 100644
--- a/askbot/views/commands.py
+++ b/askbot/views/commands.py
@@ -32,6 +32,7 @@ from askbot.utils import decorators
from askbot.utils import url_utils
from askbot.utils.forms import get_db_object_or_404
from askbot import mail
+from django.template import Context
from askbot.skins.loaders import render_into_skin, get_template
from askbot.skins.loaders import render_into_skin_as_string
from askbot.skins.loaders import render_text_into_skin
@@ -106,17 +107,12 @@ def manage_inbox(request):
reject_reason = models.PostFlagReason.objects.get(
id = post_data['reject_reason_id']
)
- body_text = string_concat(
- _('Your post (copied in the end),'),
- '<br/>',
- _('was rejected for the following reason:'),
- '<br/><br/>',
- reject_reason.details.html,
- '<br/><br/>',
- _('Here is your original post'),
- '<br/><br/>',
- post.text
- )
+ template = get_template('email/rejected_post.html')
+ data = {
+ 'post': post.html,
+ 'reject_reason': reject_reason.details.html
+ }
+ body_text = template.render(Context(data))
mail.send_mail(
subject_line = _('your post was not accepted'),
body_text = unicode(body_text),
@@ -1355,7 +1351,7 @@ def get_editor(request):
#parse out javascript and dom, and return them separately
#we need that, because js needs to be added in a special way
html_soup = BeautifulSoup(editor_html)
-
+
parsed_scripts = list()
for script in html_soup.find_all('script'):
parsed_scripts.append({