diff --git a/static/mailman_django/css/basics.css b/static/mailman_django/css/basics.css index c902c11..e92c38b 100644 --- a/static/mailman_django/css/basics.css +++ b/static/mailman_django/css/basics.css @@ -156,5 +156,12 @@ border-radius:5px; } +#error { + background-color:rgba(255, 0, 0, 0.2); + border:1px solid rgba(255, 0, 0, 1); + padding:3px; + border-radius:5px; +} + @media screen and (max-width: 600px) { } diff --git a/templates/mailman-django/base.html b/templates/mailman-django/base.html index b032398..26fb4cf 100644 --- a/templates/mailman-django/base.html +++ b/templates/mailman-django/base.html @@ -39,6 +39,9 @@ {% if message %}

{{ message }}

{% endif %} + {% if error %} +

{{ error }}

+ {% endif %}
{% block content %}{% endblock %}
diff --git a/templates/mailman-django/errors/generic.html b/templates/mailman-django/errors/generic.html index 9aff64c..2de5745 100644 --- a/templates/mailman-django/errors/generic.html +++ b/templates/mailman-django/errors/generic.html @@ -3,8 +3,8 @@ {% block content %} -

{% trans "Error" %}

- -

{{ message }}

+

{% trans "Error-Site" %}

+{% if error %}

{{ error }}

{% endif %} +{% if message %}

{{ message }}

{% endif %} {% endblock %} diff --git a/templates/mailman-django/lists/settings.html b/templates/mailman-django/lists/settings.html index 0e4587c..4345737 100644 --- a/templates/mailman-django/lists/settings.html +++ b/templates/mailman-django/lists/settings.html @@ -8,7 +8,7 @@ {% blocktrans %} - You can also subscribe or unsubscribe a user to the list "the normal way" or delete the list. If you wish to mass subscribe users to this list, please click here. + If you wish to mass subscribe users to this list, please click here. {% endblocktrans %} {% endblock %} @@ -19,7 +19,7 @@

{% trans "This page visualizes all list settings. This gives an idea of what the settings page could look like." %}

-TODO:url not GET{{ form.as_div }} +{{ form.as_div }}
diff --git a/templates/mailman-django/lists/subscriptions.html b/templates/mailman-django/lists/subscriptions.html index 0da5094..0e53d0a 100644 --- a/templates/mailman-django/lists/subscriptions.html +++ b/templates/mailman-django/lists/subscriptions.html @@ -8,27 +8,6 @@ {% if form_subscribe %} {{ form_subscribe.as_div }} -
diff --git a/templates/mailman-django/menu/maintanance.html b/templates/mailman-django/menu/maintanance.html index 56d9d48..17336b2 100644 --- a/templates/mailman-django/menu/maintanance.html +++ b/templates/mailman-django/menu/maintanance.html @@ -9,8 +9,8 @@
  • - - {% trans "Auto Responder" %} Link:TODO + + {% trans "Auto Responder" %}
    • diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index 77d25a0..0000000 --- a/tests/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 1998-2010 by the Free Software Foundation, Inc. -# -# This file is part of GNU Mailman. -# -# GNU Mailman is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation, either version 3 of the License, or (at your option) -# any later version. -# -# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# GNU Mailman. If not, see . - -import tests -__test__ = { - "Doctest": tests, -} diff --git a/views.py b/views.py index 7d799c0..99a44ce 100644 --- a/views.py +++ b/views.py @@ -80,6 +80,7 @@ @login_required def domains(request, template = 'mailman-django/domains.html'): message="" + error="" if request.method == 'POST': form = DomainNew(request.POST) existing_domains = None @@ -92,23 +93,24 @@ try: domain = c.create_domain(mail_host,web_host,description) except HTTPError, e: - message=e + error=e existing_domains = c.domains except AttributeError, e: return render_to_response('mailman-django/errors/generic.html', - {'message': "REST API not found / Offline"},context_instance=RequestContext(request)) + {'error': "REST API not found / Offline"},context_instance=RequestContext(request)) else: try: c = Client('http://localhost:8001/3.0', API_USER, API_PASS) existing_domains = c.domains except AttributeError, e: return render_to_response('mailman-django/errors/generic.html', - {'message': "REST API not found / Offline"},context_instance=RequestContext(request)) + {'error': "REST API not found / Offline"},context_instance=RequestContext(request)) form = DomainNew() return render_to_response(template, {'form': form, 'domains':existing_domains, 'message':message, + 'error':error, },context_instance=RequestContext(request)) @login_required @@ -131,12 +133,14 @@ filled in before the last POST request is returned. The user must be logged in to create a new list. """ + error=None + message=None if request.method == 'POST': try: c = Client('http://localhost:8001/3.0', API_USER, API_PASS) except AttributeError, e: return render_to_response('mailman-django/errors/generic.html', - {'message': "REST API not found / Offline"},context_instance=RequestContext(request)) + {'error': "REST API not found / Offline"},context_instance=RequestContext(request)) choosable_domains = [("",_("Choose a Domain"))] for domain in c.domains: choosable_domains.append((domain.email_host,domain.email_host)) @@ -149,7 +153,7 @@ try: mailing_list = domain.create_list(form.cleaned_data['listname']) except HTTPError, e: #TODO catch correct Error class - message = e + error = e #saving settings settings = mailing_list.settings """ @@ -158,26 +162,28 @@ #settings["???"] = form.cleaned_data['list_type'] #TODO not found in REST #settings["???"] = form.cleaned_data['languages'] #TODO not found in REST settings.save()""" - return render_to_response('mailman-django/lists/created.html', - {'fqdn_listname': settings['fqdn_listname']} - ,context_instance=RequestContext(request)) + return render_to_response('mailman-django/lists/created.html', {'fqdn_listname': settings['fqdn_listname'], + 'message':message, + 'error':error}, + context_instance=RequestContext(request)) else: try: c = Client('http://localhost:8001/3.0', API_USER, API_PASS) except AttributeError, e: return render_to_response('mailman-django/errors/generic.html', - {'message': "REST API not found / Offline"},context_instance=RequestContext(request)) + {'error': "REST API not found / Offline"},context_instance=RequestContext(request)) choosable_domains = [("",_("Choose a Domain"))] for domain in c.domains: choosable_domains.append((domain.email_host,domain.email_host)) form = ListNew(choosable_domains) - return render_to_response(template, {'form': form},context_instance=RequestContext(request)) + return render_to_response(template, {'form': form, error:None}, context_instance=RequestContext(request)) def list_index(request, template = 'mailman-django/lists/index.html'): """Show a table of all mailing lists. """ + error=None if request.method == 'POST': return redirect("list_summary", fqdn_listname=request.POST["list"]) else: @@ -186,8 +192,8 @@ lists = c.lists except AttributeError, e: return render_to_response('mailman-django/errors/generic.html', - {'message': "REST API not found / Offline"},context_instance=RequestContext(request)) - return render_to_response(template, {'lists': lists},context_instance=RequestContext(request)) + {'error': "REST API not found / Offline"},context_instance=RequestContext(request)) + return render_to_response(template, {'lists': lists,'error':error},context_instance=RequestContext(request)) def list_summary(request,fqdn_listname=None,option=None):#TODO @@ -215,10 +221,10 @@ the_list = c.get_list(fqdn_listname) except AttributeError, e: return render_to_response('mailman-django/errors/generic.html', - {'message': "REST API not found / Offline"},context_instance=RequestContext(request)) + {'error': "REST API not found / Offline"},context_instance=RequestContext(request)) except HTTPError,e : return render_to_response('mailman-django/errors/generic.html', - {'message': -("List ")+fqdn_listname+_(" does not exist")},context_instance=RequestContext(request)) + {'error': _("List ")+fqdn_listname+_(" does not exist")},context_instance=RequestContext(request)) if request.method == 'POST': form = False @@ -283,10 +289,10 @@ the_list.delete() except AttributeError, e: return render_to_response('mailman-django/errors/generic.html', - {'message': "REST API not found / Offline"},context_instance=RequestContext(request)) + {'error': "REST API not found / Offline"},context_instance=RequestContext(request)) except HTTPError,e : return render_to_response('mailman-django/errors/generic.html', - {'message': -("List ")+fqdn_listname+_(" does not exist")},context_instance=RequestContext(request)) + {'error': _("List ")+fqdn_listname+_(" does not exist")},context_instance=RequestContext(request)) # let the user return to the list index page lists = c.lists return redirect("list_index") @@ -311,10 +317,10 @@ the_list = c.get_list(fqdn_listname) except AttributeError, e: return render_to_response('mailman-django/errors/generic.html', - {'message': "REST API not found / Offline"},context_instance=RequestContext(request)) + {'error': "REST API not found / Offline"},context_instance=RequestContext(request)) except HTTPError,e : return render_to_response('mailman-django/errors/generic.html', - {'message': _("List ")+fqdn_listname+_(" does not exist")},context_instance=RequestContext(request)) + {'error': _("List ")+fqdn_listname+_(" does not exist")},context_instance=RequestContext(request)) #Save a Form Processed by POST if request.method == 'POST': form = ListSettings(visible_section,visible_option,data=request.POST) @@ -363,10 +369,10 @@ the_list = c.get_list(fqdn_listname) except AttributeError, e: return render_to_response('mailman-django/errors/generic.html', - {'message': "REST API not found / Offline"},context_instance=RequestContext(request)) + {'error': "REST API not found / Offline"},context_instance=RequestContext(request)) except HTTPError,e : return render_to_response('mailman-django/errors/generic.html', - {'message': -("List ")+fqdn_listname+_(" does not exist")},context_instance=RequestContext(request)) + {'error': _("List ")+fqdn_listname+_(" does not exist")},context_instance=RequestContext(request)) if request.method == 'POST': form = ListMassSubscription(request.POST) if form.is_valid(): @@ -382,7 +388,9 @@ the_list.subscribe(address=email, real_name="") message = "The mass subscription was successful." except Exception, e: #TODO find right exception and catch only this one - message = e + return render_to_response('mailman-django/errors/generic.html', + {'error': str(e)}) + else: # At least one email address wasn't valid so # overwrite the success message and ask them to