From e2f6773146d04da9349ad06910a37e4bfc5f9052 Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Tue, 5 Nov 2013 12:23:31 -0200 Subject: [PATCH] Fixing message sending --- src/super_archives/templates/superarchives/includes/message.html | 2 +- src/super_archives/views.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/super_archives/templates/superarchives/includes/message.html b/src/super_archives/templates/superarchives/includes/message.html index 248e901..af3891f 100644 --- a/src/super_archives/templates/superarchives/includes/message.html +++ b/src/super_archives/templates/superarchives/includes/message.html @@ -53,7 +53,7 @@
{% csrf_token %}

- +

{% trans "After sending a message it will take few minutes before it shows up in here. Why don't you grab a coffee?" %}

diff --git a/src/super_archives/views.py b/src/super_archives/views.py index d19f8f3..a6d8c3c 100644 --- a/src/super_archives/views.py +++ b/src/super_archives/views.py @@ -79,10 +79,10 @@ def thread_post(request, mailinglist, thread_token): raise http.Http404 data = {} - data['email_from'] = '{} <{}>'.format(request.user.get_full_name(), + data['from'] = '{} <{}>'.format(request.user.get_full_name(), request.user.email) data['subject'] = thread.message_set.first().subject_clean - data['body'] = request.POST.get('body', '').strip() + data['body'] = request.POST.get('emailbody', '').strip() url = urlparse.urljoin(settings.MAILMAN_API_URL, mailinglist + '/sendmail') @@ -103,10 +103,13 @@ def thread_post(request, mailinglist, thread_token): "in the meanwhile.")) else: if not error_msg: - if resp and resp.status_code == 400: - error_msg = _('You cannot send an empty email') + if resp is not None: + if resp.status_code == 400: + error_msg = _('You cannot send an empty email') + elif resp.status_code == 404: + error_msg = _('Mailing list does not exist') else: - error_msg = _('Unkown error trying to connect to Mailman API') + error_msg = _('Unkown error trying to connect to Mailman API') messages.error(request, error_msg) return thread_get(request, mailinglist, thread_token) -- libgit2 0.21.2