diff --git a/src/postorius/auth/decorators.py b/src/postorius/auth/decorators.py index 80f39dc..1b4ea88 100644 --- a/src/postorius/auth/decorators.py +++ b/src/postorius/auth/decorators.py @@ -29,7 +29,7 @@ def wrapper(*args, **kwargs): request = args[0] if request.user.is_authenticated(): - print 'already logged in' + print('already logged in') if not request.user.is_authenticated(): if request.META.has_key('HTTP_AUTHORIZATION'): authmeth, auth = request.META['HTTP_AUTHORIZATION'].split(' ', diff --git a/src/postorius/forms.py b/src/postorius/forms.py index d24651c..a13d814 100644 --- a/src/postorius/forms.py +++ b/src/postorius/forms.py @@ -19,7 +19,7 @@ from django import forms from django.core.validators import validate_email, URLValidator from django.utils.translation import ugettext_lazy as _ -from fieldset_forms import FieldsetForm +from postorius.fieldset_forms import FieldsetForm class DomainNew(FieldsetForm): @@ -560,7 +560,7 @@ class ListSubscriptionPolicyForm(forms.Form): """ List subscription policy settings. - """ + """ subscription_policy = forms.ChoiceField( label=_('Subscription Policy'), choices=SUBSCRIPTION_POLICY_CHOICES, diff --git a/src/postorius/models.py b/src/postorius/models.py index cb79995..bdc7ee8 100644 --- a/src/postorius/models.py +++ b/src/postorius/models.py @@ -37,8 +37,10 @@ from django.template.loader import get_template from mailmanclient import MailmanConnectionError from postorius.utils import get_client -from urllib2 import HTTPError - +try: + from urllib2 import HTTPError +except ImportError: + from urllib.error import HTTPError logger = logging.getLogger(__name__) @@ -84,21 +86,21 @@ return getattr(get_client(), self.resource_name_plural) except AttributeError: raise MailmanApiError - except MailmanConnectionError, e: + except MailmanConnectionError as e: raise MailmanApiError(e) def get(self, **kwargs): try: method = getattr(get_client(), 'get_' + self.resource_name) return method(**kwargs) - except AttributeError, e: + except AttributeError as e: raise MailmanApiError(e) - except HTTPError, e: + except HTTPError as e: if e.code == 404: raise Mailman404Error('Mailman resource could not be found.') else: raise - except MailmanConnectionError, e: + except MailmanConnectionError as e: raise MailmanApiError(e) def get_or_404(self, **kwargs): @@ -108,16 +110,16 @@ return self.get(**kwargs) except Mailman404Error: raise Http404 - except MailmanConnectionError, e: + except MailmanConnectionError as e: raise MailmanApiError(e) def create(self, **kwargs): try: method = getattr(get_client(), 'create_' + self.resource_name) return method(**kwargs) - except AttributeError, e: + except AttributeError as e: raise MailmanApiError(e) - except HTTPError, e: + except HTTPError as e: if e.code == 409: raise MailmanApiError else: @@ -142,7 +144,7 @@ objects = getattr(get_client(), self.resource_name_plural) except AttributeError: raise MailmanApiError - except MailmanConnectionError, e: + except MailmanConnectionError as e: raise MailmanApiError(e) if only_public: public = [] diff --git a/src/postorius/templates/postorius/lists/memberoptions.html b/src/postorius/templates/postorius/lists/memberoptions.html index 06342f0..f61433d 100644 --- a/src/postorius/templates/postorius/lists/memberoptions.html +++ b/src/postorius/templates/postorius/lists/memberoptions.html @@ -31,7 +31,7 @@

{% trans 'Mail Delivery:' %}

- [{% trans "More info" %}{{ settingsform.delivery_status.help_text }} + [{% trans "More info" %}{{ settingsform.delivery_status.help_text }} ]

{{settingsform.delivery_status }} @@ -40,7 +40,7 @@

{% trans 'Mode of Delivery:' %}

- [{% trans "More info" %}{{ settingsform.delivery_mode.help_text }} + [{% trans "More info" %}{{ settingsform.delivery_mode.help_text }} ]

{{settingsform.delivery_mode }} @@ -49,7 +49,7 @@

{% trans 'Receive own posts to the list?' %}

- [{% trans "More info" %}{{ settingsform.receive_own_postings.help_text }} + [{% trans "More info" %}{{ settingsform.receive_own_postings.help_text }} ]

{{settingsform.receive_own_postings }} @@ -58,7 +58,7 @@

{% trans 'Receive acknowledgement mails?' %}

- [{% trans "More info" %}{{ settingsform.acknowledge_posts.help_text }} + [{% trans "More info" %}{{ settingsform.acknowledge_posts.help_text }} ]

{{settingsform.acknowledge_posts }} @@ -67,7 +67,7 @@

{% trans 'Conceal address from the subscriber list?' %}

- [{% trans "More info" %}{{ settingsform.hide_address.help_text }} + [{% trans "More info" %}{{ settingsform.hide_address.help_text }} ]

{{settingsform.hide_address }} @@ -75,7 +75,8 @@

{% trans 'Avoid duplicate copies of messages? ' %}

-

[{% trans "More info" %}{{ settingsform.receive_list_copy.help_text }} +

+ [{% trans "More info" %}{{ settingsform.receive_list_copy.help_text }} ]

{{settingsform.receive_list_copy }} diff --git a/src/postorius/templates/postorius/lists/settings_legacy.html b/src/postorius/templates/postorius/lists/settings_legacy.html index 8836554..5998cbb 100644 --- a/src/postorius/templates/postorius/lists/settings_legacy.html +++ b/src/postorius/templates/postorius/lists/settings_legacy.html @@ -20,7 +20,7 @@ {{ field.errors }} {{ field.label_tag }}
- [{% trans "More info" %}{{ field.help_text }} + [{% trans "More info" %}{{ field.help_text }} ] {{ field }} {% endfor %} diff --git a/src/postorius/templates/postorius/menu/list_nav.html b/src/postorius/templates/postorius/menu/list_nav.html index 98900a6..e209fa1 100644 --- a/src/postorius/templates/postorius/menu/list_nav.html +++ b/src/postorius/templates/postorius/menu/list_nav.html @@ -6,28 +6,16 @@ {% if user|lower != 'anonymoususer' %} diff --git a/src/postorius/templates/postorius/user_address_preferences.html b/src/postorius/templates/postorius/user_address_preferences.html index 7435c7e..600e8a1 100644 --- a/src/postorius/templates/postorius/user_address_preferences.html +++ b/src/postorius/templates/postorius/user_address_preferences.html @@ -36,7 +36,7 @@

{% trans 'Mail Delivery' %}:

-

[{% trans 'More info' %}{{ helperform.delivery_status.help_text }} +

[{% trans 'More info' %}{{ helperform.delivery_status.help_text }} ]

@@ -47,7 +47,7 @@

{% trans 'Select a Mode of Delivery' %}:

-

[{% trans 'More info' %}{{ helperform.delivery_mode.help_text }} +

[{% trans 'More info' %}{{ helperform.delivery_mode.help_text }} ]

@@ -58,7 +58,7 @@

{% trans 'Receive your own posts to the list?' %}

-

[{% trans 'More info' %}{{ helperform.receive_own_postings.help_text }} +

[{% trans 'More info' %}{{ helperform.receive_own_postings.help_text }} ]

@@ -69,7 +69,7 @@

{% trans 'Receive acknowledgement mails?' %}

-

[{% trans 'More info' %}{{ helperform.acknowledge_posts.help_text }} +

[{% trans 'More info' %}{{ helperform.acknowledge_posts.help_text }} ]

@@ -80,7 +80,7 @@

{% trans 'Conceal yourself from the subscriber list?' %}

-

[{% trans 'More info' %}{{ helperform.hide_address.help_text }} +

[{% trans 'More info' %}{{ helperform.hide_address.help_text }} ]

@@ -91,7 +91,7 @@

{% trans 'Avoid duplicate copies of messages?' %}

-

[{% trans 'More info' %}{{ helperform.receive_list_copy.help_text }} +

[{% trans 'More info' %}{{ helperform.receive_list_copy.help_text }} ]

diff --git a/src/postorius/templates/postorius/user_mailmansettings.html b/src/postorius/templates/postorius/user_mailmansettings.html index 10382cc..7f2a4b7 100644 --- a/src/postorius/templates/postorius/user_mailmansettings.html +++ b/src/postorius/templates/postorius/user_mailmansettings.html @@ -32,7 +32,7 @@

{% trans "Mail Delivery" %}:

- [{% trans 'More info' %}{{ settingsform.delivery_status.help_text }} + [{% trans 'More info' %}{{ settingsform.delivery_status.help_text }} ]

{{settingsform.delivery_status }} @@ -41,7 +41,7 @@

{% trans "Select a Mode of Delivery" %}:

- [{% trans 'More info' %}{{ settingsform.delivery_mode.help_text }} + [{% trans 'More info' %}{{ settingsform.delivery_mode.help_text }} ]

{{settingsform.delivery_mode }} @@ -50,7 +50,7 @@

{% trans "Receive your own posts to the list?" %}

- [{% trans 'More info' %}{{ settingsform.receive_own_postings.help_text }} + [{% trans 'More info' %}{{ settingsform.receive_own_postings.help_text }} ]

{{settingsform.receive_own_postings }} @@ -59,7 +59,7 @@

{% trans "Receive acknowledgement mails?" %}

- [{% trans 'More info' %}{{ settingsform.acknowledge_posts.help_text }} + [{% trans 'More info' %}{{ settingsform.acknowledge_posts.help_text }} ]

{{settingsform.acknowledge_posts }} @@ -68,7 +68,7 @@

{% trans "Conceal yourself from the subscriber list?" %}

- [{% trans 'More info' %}{{ settingsform.hide_address.help_text }} + [{% trans 'More info' %}{{ settingsform.hide_address.help_text }} ]

{{settingsform.hide_address }} @@ -76,7 +76,8 @@

{% trans "Avoid duplicate copies of messages?" %}

-

[{% trans 'More info' %}{{ settingsform.receive_list_copy.help_text }} +

+ [{% trans 'More info' %}{{ settingsform.receive_list_copy.help_text }} ]

{{settingsform.receive_list_copy }} diff --git a/src/postorius/templates/postorius/user_subscription_preferences.html b/src/postorius/templates/postorius/user_subscription_preferences.html index 9b558ff..ef5afab 100644 --- a/src/postorius/templates/postorius/user_subscription_preferences.html +++ b/src/postorius/templates/postorius/user_subscription_preferences.html @@ -30,7 +30,7 @@ {% trans 'Subscription' %} {% for field in form.visible_fields %} - {{field.label}}

[{% trans 'More info' %}{{ field.help_text }} + {{field.label}}

[{% trans 'More info' %}{{ field.help_text }} ]

{% endfor %} diff --git a/src/postorius/tests/fixtures/vcr_cassettes/test_list_index.yaml b/src/postorius/tests/fixtures/vcr_cassettes/test_list_index.yaml index 36f5810..c24eccc 100644 --- a/src/postorius/tests/fixtures/vcr_cassettes/test_list_index.yaml +++ b/src/postorius/tests/fixtures/vcr_cassettes/test_list_index.yaml @@ -5,51 +5,33 @@ accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'POST' uri: http://localhost:9001/3.0/domains response: - body: {string: !!python/unicode 'Duplicate email host: example.com'} + body: {string: !!python/unicode ''} headers: - content-length: ['33'] - content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] + content-length: ['0'] + date: ['Thu, 06 Aug 2015 05:11:52 GMT'] + location: ['http://localhost:9001/3.0/domains/example.com'] server: [WSGIServer/0.2 CPython/3.4.2] - status: {code: 400, message: Bad Request} + status: {code: 201, message: Created} - request: body: null headers: accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/domains/example.com response: - body: {string: !!python/unicode '{"base_url": "http://example.com", "mail_host": - "example.com", "description": null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", - "url_host": "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com"}'} + body: {string: !!python/unicode '{"base_url": "http://example.com", "http_etag": + "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", "self_link": "http://localhost:9001/3.0/domains/example.com", + "description": null, "mail_host": "example.com", "url_host": "example.com"}'} headers: content-length: ['233'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] - server: [WSGIServer/0.2 CPython/3.4.2] - status: {code: 200, message: OK} -- request: - body: null - headers: - accept-encoding: ['gzip, deflate'] - !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] - method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/domains/example.com - response: - body: {string: !!python/unicode '{"base_url": "http://example.com", "mail_host": - "example.com", "description": null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", - "url_host": "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com"}'} - headers: - content-length: ['233'] - content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] + date: ['Thu, 06 Aug 2015 05:11:52 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -58,35 +40,56 @@ accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'POST' uri: http://localhost:9001/3.0/lists response: body: {string: !!python/unicode ''} headers: content-length: ['0'] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] + date: ['Thu, 06 Aug 2015 05:11:52 GMT'] location: ['http://localhost:9001/3.0/lists/foo.example.com'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 201, message: Created} - request: + body: fqdn_listname=bar%40example.com + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'content-type': [!!python/unicode 'application/x-www-form-urlencoded'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'POST' + uri: http://localhost:9001/3.0/lists + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Thu, 06 Aug 2015 05:11:52 GMT'] + location: ['http://localhost:9001/3.0/lists/bar.example.com'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 201, message: Created} +- request: body: null headers: accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists response: - body: {string: !!python/unicode '{"total_size": 1, "start": 0, "entries": [{"volume": - 1, "mail_host": "example.com", "list_name": "foo", "display_name": "Foo", - "list_id": "foo.example.com", "member_count": 0, "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "self_link": - "http://localhost:9001/3.0/lists/foo.example.com"}], "http_etag": "\"0eb6d0b88c89b5c491b7966eab97a79e221096ad\""}'} + body: {string: !!python/unicode '{"http_etag": "\"32ddcf601b73aeabdba5c18666c75d062c76eac8\"", + "entries": [{"volume": 1, "self_link": "http://localhost:9001/3.0/lists/foo.example.com", + "list_name": "foo", "display_name": "Foo", "mail_host": "example.com", "http_etag": + "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "member_count": 0, "fqdn_listname": + "foo@example.com", "list_id": "foo.example.com"}, {"volume": 1, "self_link": + "http://localhost:9001/3.0/lists/bar.example.com", "list_name": "bar", "display_name": + "Bar", "mail_host": "example.com", "http_etag": "\"ca42a69a3bab5619e147cc6cbbfca16115976764\"", + "member_count": 0, "fqdn_listname": "bar@example.com", "list_id": "bar.example.com"}], + "total_size": 2, "start": 0}'} headers: - content-length: ['399'] + content-length: ['695'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] + date: ['Thu, 06 Aug 2015 05:11:52 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -94,18 +97,18 @@ headers: accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo.example.com response: - body: {string: !!python/unicode '{"volume": 1, "mail_host": "example.com", "list_name": - "foo", "display_name": "Foo", "list_id": "foo.example.com", "member_count": - 0, "fqdn_listname": "foo@example.com", "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", - "self_link": "http://localhost:9001/3.0/lists/foo.example.com"}'} + body: {string: !!python/unicode '{"volume": 1, "self_link": "http://localhost:9001/3.0/lists/foo.example.com", + "list_name": "foo", "display_name": "Foo", "mail_host": "example.com", "http_etag": + "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "member_count": 0, "fqdn_listname": + "foo@example.com", "list_id": "foo.example.com"}'} headers: content-length: ['294'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] + date: ['Thu, 06 Aug 2015 05:11:52 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -113,34 +116,35 @@ headers: accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo@example.com/config response: - body: {string: !!python/unicode '{"scheme": "http", "list_name": "foo", "reply_to_address": - "", "next_digest_number": 1, "post_id": 1, "bounces_address": "foo-bounces@example.com", - "posting_pipeline": "default-posting-pipeline", "advertised": true, "no_reply_address": - "noreply@example.com", "autoresponse_owner_text": "", "last_post_at": null, - "allow_list_posts": true, "join_address": "foo-join@example.com", "acceptable_aliases": - [], "filter_content": false, "web_host": "example.com", "default_member_action": - "defer", "anonymous_list": false, "autorespond_postings": "none", "leave_address": - "foo-leave@example.com", "autoresponse_postings_text": "", "autoresponse_request_text": - "", "description": "", "admin_immed_notify": true, "collapse_alternatives": - true, "archive_policy": "public", "send_welcome_message": true, "created_at": - "2015-04-17T21:49:43.384633", "include_rfc2369_headers": true, "first_strip_reply_to": - false, "welcome_message_uri": "mailman:///welcome.txt", "administrivia": true, - "digest_last_sent_at": null, "admin_notify_mchanges": false, "digest_size_threshold": - 30.0, "default_nonmember_action": "hold", "subject_prefix": "[Foo] ", "request_address": - "foo-request@example.com", "autorespond_requests": "none", "volume": 1, "reply_goes_to_list": - "no_munging", "mail_host": "example.com", "autoresponse_grace_period": "90d", - "subscription_policy": "confirm", "display_name": "Foo", "convert_html_to_plaintext": - false, "owner_address": "foo-owner@example.com", "fqdn_listname": "foo@example.com", - "posting_address": "foo@example.com", "http_etag": "\"1ec2b61b7c20b4896f60090e43838cc722a2f4ab\"", - "autorespond_owner": "none"}'} + body: {string: !!python/unicode '{"bounces_address": "foo-bounces@example.com", + "join_address": "foo-join@example.com", "next_digest_number": 1, "volume": + 1, "allow_list_posts": true, "scheme": "http", "reply_to_address": "", "digest_last_sent_at": + null, "no_reply_address": "noreply@example.com", "reply_goes_to_list": "no_munging", + "archive_policy": "public", "default_nonmember_action": "hold", "list_name": + "foo", "leave_address": "foo-leave@example.com", "subscription_policy": "confirm", + "posting_pipeline": "default-posting-pipeline", "first_strip_reply_to": false, + "collapse_alternatives": true, "filter_content": false, "admin_immed_notify": + true, "http_etag": "\"193295c218323732142ae2da3a2767f9ae432ffe\"", "anonymous_list": + false, "include_rfc2369_headers": true, "post_id": 1, "display_name": "Foo", + "autorespond_requests": "none", "welcome_message_uri": "mailman:///welcome.txt", + "convert_html_to_plaintext": false, "advertised": true, "digest_size_threshold": + 30.0, "web_host": "example.com", "posting_address": "foo@example.com", "fqdn_listname": + "foo@example.com", "last_post_at": null, "autoresponse_owner_text": "", "acceptable_aliases": + [], "owner_address": "foo-owner@example.com", "created_at": "2015-08-06T05:11:52.442675", + "request_address": "foo-request@example.com", "subject_prefix": "[Foo] ", + "mail_host": "example.com", "admin_notify_mchanges": false, "administrivia": + true, "default_member_action": "defer", "autoresponse_postings_text": "", + "autoresponse_request_text": "", "send_welcome_message": true, "description": + "", "autorespond_postings": "none", "autoresponse_grace_period": "90d", "autorespond_owner": + "none"}'} headers: content-length: ['1617'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] + date: ['Thu, 06 Aug 2015 05:11:52 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -148,19 +152,74 @@ headers: accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/bar.example.com + response: + body: {string: !!python/unicode '{"volume": 1, "self_link": "http://localhost:9001/3.0/lists/bar.example.com", + "list_name": "bar", "display_name": "Bar", "mail_host": "example.com", "http_etag": + "\"ca42a69a3bab5619e147cc6cbbfca16115976764\"", "member_count": 0, "fqdn_listname": + "bar@example.com", "list_id": "bar.example.com"}'} + headers: + content-length: ['294'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 06 Aug 2015 05:11:52 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/bar@example.com/config + response: + body: {string: !!python/unicode '{"bounces_address": "bar-bounces@example.com", + "join_address": "bar-join@example.com", "next_digest_number": 1, "volume": + 1, "allow_list_posts": true, "scheme": "http", "reply_to_address": "", "digest_last_sent_at": + null, "no_reply_address": "noreply@example.com", "reply_goes_to_list": "no_munging", + "archive_policy": "public", "default_nonmember_action": "hold", "list_name": + "bar", "leave_address": "bar-leave@example.com", "subscription_policy": "confirm", + "posting_pipeline": "default-posting-pipeline", "first_strip_reply_to": false, + "collapse_alternatives": true, "filter_content": false, "admin_immed_notify": + true, "http_etag": "\"9744725b871c949b1c90abc2a6b27ab4e7b918c2\"", "anonymous_list": + false, "include_rfc2369_headers": true, "post_id": 1, "display_name": "Bar", + "autorespond_requests": "none", "welcome_message_uri": "mailman:///welcome.txt", + "convert_html_to_plaintext": false, "advertised": true, "digest_size_threshold": + 30.0, "web_host": "example.com", "posting_address": "bar@example.com", "fqdn_listname": + "bar@example.com", "last_post_at": null, "autoresponse_owner_text": "", "acceptable_aliases": + [], "owner_address": "bar-owner@example.com", "created_at": "2015-08-06T05:11:52.554133", + "request_address": "bar-request@example.com", "subject_prefix": "[Bar] ", + "mail_host": "example.com", "admin_notify_mchanges": false, "administrivia": + true, "default_member_action": "defer", "autoresponse_postings_text": "", + "autoresponse_request_text": "", "send_welcome_message": true, "description": + "", "autorespond_postings": "none", "autoresponse_grace_period": "90d", "autorespond_owner": + "none"}'} + headers: + content-length: ['1617'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 06 Aug 2015 05:11:52 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/domains response: - body: {string: !!python/unicode '{"total_size": 1, "start": 0, "entries": [{"base_url": - "http://example.com", "mail_host": "example.com", "description": null, "http_etag": - "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", "url_host": "example.com", - "self_link": "http://localhost:9001/3.0/domains/example.com"}], "http_etag": - "\"c385b155f8da284bf78dbe075e20f58a30c893ab\""}'} + body: {string: !!python/unicode '{"http_etag": "\"c385b155f8da284bf78dbe075e20f58a30c893ab\"", + "entries": [{"base_url": "http://example.com", "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", + "self_link": "http://localhost:9001/3.0/domains/example.com", "description": + null, "mail_host": "example.com", "url_host": "example.com"}], "total_size": + 1, "start": 0}'} headers: content-length: ['338'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] + date: ['Thu, 06 Aug 2015 05:11:52 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -168,17 +227,17 @@ headers: accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/domains/example.com response: - body: {string: !!python/unicode '{"base_url": "http://example.com", "mail_host": - "example.com", "description": null, "http_etag": "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", - "url_host": "example.com", "self_link": "http://localhost:9001/3.0/domains/example.com"}'} + body: {string: !!python/unicode '{"base_url": "http://example.com", "http_etag": + "\"e736411818ff1815ca83575e0958c38c5188f0a4\"", "self_link": "http://localhost:9001/3.0/domains/example.com", + "description": null, "mail_host": "example.com", "url_host": "example.com"}'} headers: content-length: ['233'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] + date: ['Thu, 06 Aug 2015 05:11:52 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -186,34 +245,35 @@ headers: accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo@example.com/config + uri: http://localhost:9001/3.0/lists/bar@example.com/config response: - body: {string: !!python/unicode '{"scheme": "http", "list_name": "foo", "reply_to_address": - "", "next_digest_number": 1, "post_id": 1, "bounces_address": "foo-bounces@example.com", - "posting_pipeline": "default-posting-pipeline", "advertised": true, "no_reply_address": - "noreply@example.com", "autoresponse_owner_text": "", "last_post_at": null, - "allow_list_posts": true, "join_address": "foo-join@example.com", "acceptable_aliases": - [], "filter_content": false, "web_host": "example.com", "default_member_action": - "defer", "anonymous_list": false, "autorespond_postings": "none", "leave_address": - "foo-leave@example.com", "autoresponse_postings_text": "", "autoresponse_request_text": - "", "description": "", "admin_immed_notify": true, "collapse_alternatives": - true, "archive_policy": "public", "send_welcome_message": true, "created_at": - "2015-04-17T21:49:43.384633", "include_rfc2369_headers": true, "first_strip_reply_to": - false, "welcome_message_uri": "mailman:///welcome.txt", "administrivia": true, - "digest_last_sent_at": null, "admin_notify_mchanges": false, "digest_size_threshold": - 30.0, "default_nonmember_action": "hold", "subject_prefix": "[Foo] ", "request_address": - "foo-request@example.com", "autorespond_requests": "none", "volume": 1, "reply_goes_to_list": - "no_munging", "mail_host": "example.com", "autoresponse_grace_period": "90d", - "subscription_policy": "confirm", "display_name": "Foo", "convert_html_to_plaintext": - false, "owner_address": "foo-owner@example.com", "fqdn_listname": "foo@example.com", - "posting_address": "foo@example.com", "http_etag": "\"1ec2b61b7c20b4896f60090e43838cc722a2f4ab\"", - "autorespond_owner": "none"}'} + body: {string: !!python/unicode '{"bounces_address": "bar-bounces@example.com", + "join_address": "bar-join@example.com", "next_digest_number": 1, "volume": + 1, "allow_list_posts": true, "scheme": "http", "reply_to_address": "", "digest_last_sent_at": + null, "no_reply_address": "noreply@example.com", "reply_goes_to_list": "no_munging", + "archive_policy": "public", "default_nonmember_action": "hold", "list_name": + "bar", "leave_address": "bar-leave@example.com", "subscription_policy": "confirm", + "posting_pipeline": "default-posting-pipeline", "first_strip_reply_to": false, + "collapse_alternatives": true, "filter_content": false, "admin_immed_notify": + true, "http_etag": "\"9744725b871c949b1c90abc2a6b27ab4e7b918c2\"", "anonymous_list": + false, "include_rfc2369_headers": true, "post_id": 1, "display_name": "Bar", + "autorespond_requests": "none", "welcome_message_uri": "mailman:///welcome.txt", + "convert_html_to_plaintext": false, "advertised": true, "digest_size_threshold": + 30.0, "web_host": "example.com", "posting_address": "bar@example.com", "fqdn_listname": + "bar@example.com", "last_post_at": null, "autoresponse_owner_text": "", "acceptable_aliases": + [], "owner_address": "bar-owner@example.com", "created_at": "2015-08-06T05:11:52.554133", + "request_address": "bar-request@example.com", "subject_prefix": "[Bar] ", + "mail_host": "example.com", "admin_notify_mchanges": false, "administrivia": + true, "default_member_action": "defer", "autoresponse_postings_text": "", + "autoresponse_request_text": "", "send_welcome_message": true, "description": + "", "autorespond_postings": "none", "autoresponse_grace_period": "90d", "autorespond_owner": + "none"}'} headers: content-length: ['1617'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] + date: ['Thu, 06 Aug 2015 05:11:53 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -221,34 +281,35 @@ headers: accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' - uri: http://localhost:9001/3.0/lists/foo@example.com/config + uri: http://localhost:9001/3.0/lists/bar@example.com/config response: - body: {string: !!python/unicode '{"scheme": "http", "list_name": "foo", "reply_to_address": - "", "next_digest_number": 1, "post_id": 1, "bounces_address": "foo-bounces@example.com", - "posting_pipeline": "default-posting-pipeline", "advertised": true, "no_reply_address": - "noreply@example.com", "autoresponse_owner_text": "", "last_post_at": null, - "allow_list_posts": true, "join_address": "foo-join@example.com", "acceptable_aliases": - [], "filter_content": false, "web_host": "example.com", "default_member_action": - "defer", "anonymous_list": false, "autorespond_postings": "none", "leave_address": - "foo-leave@example.com", "autoresponse_postings_text": "", "autoresponse_request_text": - "", "description": "", "admin_immed_notify": true, "collapse_alternatives": - true, "archive_policy": "public", "send_welcome_message": true, "created_at": - "2015-04-17T21:49:43.384633", "include_rfc2369_headers": true, "first_strip_reply_to": - false, "welcome_message_uri": "mailman:///welcome.txt", "administrivia": true, - "digest_last_sent_at": null, "admin_notify_mchanges": false, "digest_size_threshold": - 30.0, "default_nonmember_action": "hold", "subject_prefix": "[Foo] ", "request_address": - "foo-request@example.com", "autorespond_requests": "none", "volume": 1, "reply_goes_to_list": - "no_munging", "mail_host": "example.com", "autoresponse_grace_period": "90d", - "subscription_policy": "confirm", "display_name": "Foo", "convert_html_to_plaintext": - false, "owner_address": "foo-owner@example.com", "fqdn_listname": "foo@example.com", - "posting_address": "foo@example.com", "http_etag": "\"1ec2b61b7c20b4896f60090e43838cc722a2f4ab\"", - "autorespond_owner": "none"}'} + body: {string: !!python/unicode '{"bounces_address": "bar-bounces@example.com", + "join_address": "bar-join@example.com", "next_digest_number": 1, "volume": + 1, "allow_list_posts": true, "scheme": "http", "reply_to_address": "", "digest_last_sent_at": + null, "no_reply_address": "noreply@example.com", "reply_goes_to_list": "no_munging", + "archive_policy": "public", "default_nonmember_action": "hold", "list_name": + "bar", "leave_address": "bar-leave@example.com", "subscription_policy": "confirm", + "posting_pipeline": "default-posting-pipeline", "first_strip_reply_to": false, + "collapse_alternatives": true, "filter_content": false, "admin_immed_notify": + true, "http_etag": "\"9744725b871c949b1c90abc2a6b27ab4e7b918c2\"", "anonymous_list": + false, "include_rfc2369_headers": true, "post_id": 1, "display_name": "Bar", + "autorespond_requests": "none", "welcome_message_uri": "mailman:///welcome.txt", + "convert_html_to_plaintext": false, "advertised": true, "digest_size_threshold": + 30.0, "web_host": "example.com", "posting_address": "bar@example.com", "fqdn_listname": + "bar@example.com", "last_post_at": null, "autoresponse_owner_text": "", "acceptable_aliases": + [], "owner_address": "bar-owner@example.com", "created_at": "2015-08-06T05:11:52.554133", + "request_address": "bar-request@example.com", "subject_prefix": "[Bar] ", + "mail_host": "example.com", "admin_notify_mchanges": false, "administrivia": + true, "default_member_action": "defer", "autoresponse_postings_text": "", + "autoresponse_request_text": "", "send_welcome_message": true, "description": + "", "autorespond_postings": "none", "autoresponse_grace_period": "90d", "autorespond_owner": + "none"}'} headers: content-length: ['1617'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] + date: ['Thu, 06 Aug 2015 05:11:53 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -256,19 +317,95 @@ headers: accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com/config + response: + body: {string: !!python/unicode '{"bounces_address": "foo-bounces@example.com", + "join_address": "foo-join@example.com", "next_digest_number": 1, "volume": + 1, "allow_list_posts": true, "scheme": "http", "reply_to_address": "", "digest_last_sent_at": + null, "no_reply_address": "noreply@example.com", "reply_goes_to_list": "no_munging", + "archive_policy": "public", "default_nonmember_action": "hold", "list_name": + "foo", "leave_address": "foo-leave@example.com", "subscription_policy": "confirm", + "posting_pipeline": "default-posting-pipeline", "first_strip_reply_to": false, + "collapse_alternatives": true, "filter_content": false, "admin_immed_notify": + true, "http_etag": "\"193295c218323732142ae2da3a2767f9ae432ffe\"", "anonymous_list": + false, "include_rfc2369_headers": true, "post_id": 1, "display_name": "Foo", + "autorespond_requests": "none", "welcome_message_uri": "mailman:///welcome.txt", + "convert_html_to_plaintext": false, "advertised": true, "digest_size_threshold": + 30.0, "web_host": "example.com", "posting_address": "foo@example.com", "fqdn_listname": + "foo@example.com", "last_post_at": null, "autoresponse_owner_text": "", "acceptable_aliases": + [], "owner_address": "foo-owner@example.com", "created_at": "2015-08-06T05:11:52.442675", + "request_address": "foo-request@example.com", "subject_prefix": "[Foo] ", + "mail_host": "example.com", "admin_notify_mchanges": false, "administrivia": + true, "default_member_action": "defer", "autoresponse_postings_text": "", + "autoresponse_request_text": "", "send_welcome_message": true, "description": + "", "autorespond_postings": "none", "autoresponse_grace_period": "90d", "autorespond_owner": + "none"}'} + headers: + content-length: ['1617'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 06 Aug 2015 05:11:53 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/foo@example.com/config + response: + body: {string: !!python/unicode '{"bounces_address": "foo-bounces@example.com", + "join_address": "foo-join@example.com", "next_digest_number": 1, "volume": + 1, "allow_list_posts": true, "scheme": "http", "reply_to_address": "", "digest_last_sent_at": + null, "no_reply_address": "noreply@example.com", "reply_goes_to_list": "no_munging", + "archive_policy": "public", "default_nonmember_action": "hold", "list_name": + "foo", "leave_address": "foo-leave@example.com", "subscription_policy": "confirm", + "posting_pipeline": "default-posting-pipeline", "first_strip_reply_to": false, + "collapse_alternatives": true, "filter_content": false, "admin_immed_notify": + true, "http_etag": "\"193295c218323732142ae2da3a2767f9ae432ffe\"", "anonymous_list": + false, "include_rfc2369_headers": true, "post_id": 1, "display_name": "Foo", + "autorespond_requests": "none", "welcome_message_uri": "mailman:///welcome.txt", + "convert_html_to_plaintext": false, "advertised": true, "digest_size_threshold": + 30.0, "web_host": "example.com", "posting_address": "foo@example.com", "fqdn_listname": + "foo@example.com", "last_post_at": null, "autoresponse_owner_text": "", "acceptable_aliases": + [], "owner_address": "foo-owner@example.com", "created_at": "2015-08-06T05:11:52.442675", + "request_address": "foo-request@example.com", "subject_prefix": "[Foo] ", + "mail_host": "example.com", "admin_notify_mchanges": false, "administrivia": + true, "default_member_action": "defer", "autoresponse_postings_text": "", + "autoresponse_request_text": "", "send_welcome_message": true, "description": + "", "autorespond_postings": "none", "autoresponse_grace_period": "90d", "autorespond_owner": + "none"}'} + headers: + content-length: ['1617'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 06 Aug 2015 05:11:53 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists response: - body: {string: !!python/unicode '{"total_size": 1, "start": 0, "entries": [{"volume": - 1, "mail_host": "example.com", "list_name": "foo", "display_name": "Foo", - "list_id": "foo.example.com", "member_count": 0, "fqdn_listname": "foo@example.com", - "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "self_link": - "http://localhost:9001/3.0/lists/foo.example.com"}], "http_etag": "\"0eb6d0b88c89b5c491b7966eab97a79e221096ad\""}'} + body: {string: !!python/unicode '{"http_etag": "\"32ddcf601b73aeabdba5c18666c75d062c76eac8\"", + "entries": [{"volume": 1, "self_link": "http://localhost:9001/3.0/lists/foo.example.com", + "list_name": "foo", "display_name": "Foo", "mail_host": "example.com", "http_etag": + "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "member_count": 0, "fqdn_listname": + "foo@example.com", "list_id": "foo.example.com"}, {"volume": 1, "self_link": + "http://localhost:9001/3.0/lists/bar.example.com", "list_name": "bar", "display_name": + "Bar", "mail_host": "example.com", "http_etag": "\"ca42a69a3bab5619e147cc6cbbfca16115976764\"", + "member_count": 0, "fqdn_listname": "bar@example.com", "list_id": "bar.example.com"}], + "total_size": 2, "start": 0}'} headers: - content-length: ['399'] + content-length: ['695'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] + date: ['Thu, 06 Aug 2015 05:11:53 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -276,18 +413,18 @@ headers: accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'GET' uri: http://localhost:9001/3.0/lists/foo.example.com response: - body: {string: !!python/unicode '{"volume": 1, "mail_host": "example.com", "list_name": - "foo", "display_name": "Foo", "list_id": "foo.example.com", "member_count": - 0, "fqdn_listname": "foo@example.com", "http_etag": "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", - "self_link": "http://localhost:9001/3.0/lists/foo.example.com"}'} + body: {string: !!python/unicode '{"volume": 1, "self_link": "http://localhost:9001/3.0/lists/foo.example.com", + "list_name": "foo", "display_name": "Foo", "mail_host": "example.com", "http_etag": + "\"698a819bbb6b902096a8c5543cc7fac2328960d5\"", "member_count": 0, "fqdn_listname": + "foo@example.com", "list_id": "foo.example.com"}'} headers: content-length: ['294'] content-type: [application/json; charset=utf-8] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] + date: ['Thu, 06 Aug 2015 05:11:53 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 200, message: OK} - request: @@ -295,14 +432,48 @@ headers: accept-encoding: ['gzip, deflate'] !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] - !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0b2'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] method: !!python/unicode 'DELETE' uri: http://localhost:9001/3.0/lists/foo@example.com response: body: {string: !!python/unicode ''} headers: content-length: ['0'] - date: ['Fri, 17 Apr 2015 21:49:43 GMT'] + date: ['Thu, 06 Aug 2015 05:11:53 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 204, message: No Content} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'GET' + uri: http://localhost:9001/3.0/lists/bar.example.com + response: + body: {string: !!python/unicode '{"volume": 1, "self_link": "http://localhost:9001/3.0/lists/bar.example.com", + "list_name": "bar", "display_name": "Bar", "mail_host": "example.com", "http_etag": + "\"ca42a69a3bab5619e147cc6cbbfca16115976764\"", "member_count": 0, "fqdn_listname": + "bar@example.com", "list_id": "bar.example.com"}'} + headers: + content-length: ['294'] + content-type: [application/json; charset=utf-8] + date: ['Thu, 06 Aug 2015 05:11:53 GMT'] + server: [WSGIServer/0.2 CPython/3.4.2] + status: {code: 200, message: OK} +- request: + body: null + headers: + accept-encoding: ['gzip, deflate'] + !!python/unicode 'authorization': [!!python/unicode 'Basic cmVzdGFkbWluOnJlc3RwYXNz'] + !!python/unicode 'user-agent': [!!python/unicode 'GNU Mailman REST client v1.0.0'] + method: !!python/unicode 'DELETE' + uri: http://localhost:9001/3.0/lists/bar@example.com + response: + body: {string: !!python/unicode ''} + headers: + content-length: ['0'] + date: ['Thu, 06 Aug 2015 05:11:53 GMT'] server: [WSGIServer/0.2 CPython/3.4.2] status: {code: 204, message: No Content} version: 1 diff --git a/src/postorius/tests/mailman_api_tests/test_archival_options.py b/src/postorius/tests/mailman_api_tests/test_archival_options.py index 5974087..199b93a 100644 --- a/src/postorius/tests/mailman_api_tests/test_archival_options.py +++ b/src/postorius/tests/mailman_api_tests/test_archival_options.py @@ -30,7 +30,10 @@ from django.core.urlresolvers import reverse from django.test import Client, RequestFactory, TestCase from django.test.utils import override_settings -from urllib2 import HTTPError +try: + from urllib2 import HTTPError +except ImportError: + from urllib.error import HTTPError from postorius.forms import ListArchiverForm from postorius.tests import MM_VCR @@ -122,7 +125,7 @@ archivers = self.m_list.archivers # Archiver is enabled by default. self.assertTrue(archivers['mail-archive']) - + with MM_VCR.use_cassette('test_list_archival_options_disable_archiver.yaml'): # Archiver is disabled after it's deactivated in the form. response = self.client.post( @@ -156,7 +159,7 @@ self.assertTrue('foo-archiver' in mock_warning.call_args[0][1]) # messages.success should not have been called. self.assertEqual(mock_success.call_count, 0) - + @mock.patch('django.contrib.messages.success') @mock.patch('django.contrib.messages.warning') def test_success_messages(self, mock_warning, mock_success): diff --git a/src/postorius/tests/mailman_api_tests/test_list_index.py b/src/postorius/tests/mailman_api_tests/test_list_index.py index ce86115..a55347a 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_index.py +++ b/src/postorius/tests/mailman_api_tests/test_list_index.py @@ -20,7 +20,10 @@ from django.core.urlresolvers import reverse from django.test import Client, SimpleTestCase from django.test.utils import override_settings -from urllib2 import HTTPError +try: + from urllib2 import HTTPError +except ImportError: + from urllib.error import HTTPError from postorius.utils import get_client from postorius.tests import MM_VCR @@ -48,6 +51,7 @@ except HTTPError: self.domain = get_client().get_domain('example.com') self.foo_list = self.domain.create_list('foo') + self.bar_list = self.domain.create_list('bar') @MM_VCR.use_cassette('test_list_index.yaml') def tearDown(self): @@ -55,10 +59,11 @@ mlist.delete() @MM_VCR.use_cassette('test_list_index.yaml') - def test_list_index_contains_one_list(self): - # The list index page should contain the + def test_list_index_contains_the_lists(self): + # The list index page should contain the lists response = self.client.get(reverse('list_index')) self.assertEqual(response.status_code, 200) - self.assertEqual(len(response.context['lists']), 1) - self.assertEqual(response.context['lists'][0].fqdn_listname, - 'foo@example.com') + self.assertEqual(len(response.context['lists']), 2) + # The lists should be sorted by address + self.assertEqual([l.fqdn_listname for l in response.context['lists']], + ['bar@example.com', 'foo@example.com']) diff --git a/src/postorius/tests/mailman_api_tests/test_list_members.py b/src/postorius/tests/mailman_api_tests/test_list_members.py index 21884d5..cd90f8d 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_members.py +++ b/src/postorius/tests/mailman_api_tests/test_list_members.py @@ -20,7 +20,10 @@ from django.core.urlresolvers import reverse from django.test import Client, TestCase from django.test.utils import override_settings -from urllib2 import HTTPError +try: + from urllib2 import HTTPError +except ImportError: + from urllib.error import HTTPError from postorius.tests import MM_VCR from postorius.utils import get_client diff --git a/src/postorius/tests/mailman_api_tests/test_list_new.py b/src/postorius/tests/mailman_api_tests/test_list_new.py index 49e6224..2824b78 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_new.py +++ b/src/postorius/tests/mailman_api_tests/test_list_new.py @@ -21,7 +21,10 @@ from django.core.urlresolvers import reverse from django.test import Client, SimpleTestCase from django.test.utils import override_settings -from urllib2 import HTTPError +try: + from urllib2 import HTTPError +except ImportError: + from urllib.error import HTTPError from postorius.utils import get_client from postorius.tests import MM_VCR diff --git a/src/postorius/tests/mailman_api_tests/test_list_summary.py b/src/postorius/tests/mailman_api_tests/test_list_summary.py index dbe927d..acb50d7 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_summary.py +++ b/src/postorius/tests/mailman_api_tests/test_list_summary.py @@ -21,7 +21,10 @@ from django.db import IntegrityError from django.test import Client, SimpleTestCase from django.test.utils import override_settings -from urllib2 import HTTPError +try: + from urllib2 import HTTPError +except ImportError: + from urllib.error import HTTPError from postorius.utils import get_client from postorius.tests import MM_VCR diff --git a/src/postorius/tests/mailman_api_tests/test_models.py b/src/postorius/tests/mailman_api_tests/test_models.py index e3278c6..655ea42 100644 --- a/src/postorius/tests/mailman_api_tests/test_models.py +++ b/src/postorius/tests/mailman_api_tests/test_models.py @@ -21,7 +21,10 @@ from django.db import IntegrityError from django.test import Client, SimpleTestCase from django.test.utils import override_settings -from urllib2 import HTTPError +try: + from urllib2 import HTTPError +except ImportError: + from urllib.error import HTTPError from postorius.utils import get_client from postorius.tests import MM_VCR diff --git a/src/postorius/tests/mailman_api_tests/test_subscriptions.py b/src/postorius/tests/mailman_api_tests/test_subscriptions.py index 5216408..6bdd987 100644 --- a/src/postorius/tests/mailman_api_tests/test_subscriptions.py +++ b/src/postorius/tests/mailman_api_tests/test_subscriptions.py @@ -20,7 +20,10 @@ from django.core.urlresolvers import reverse from django.test import Client, TestCase from django.test.utils import override_settings -from urllib2 import HTTPError +try: + from urllib2 import HTTPError +except ImportError: + from urllib.error import HTTPError from postorius.tests import MM_VCR from postorius.utils import get_client diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index 9d5d986..3b63d3a 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -30,8 +30,10 @@ from django.core.exceptions import ValidationError from django.utils.decorators import method_decorator from django.utils.translation import gettext as _ -from urllib2 import HTTPError - +try: + from urllib2 import HTTPError +except ImportError: + from urllib.error import HTTPError from postorius import utils from postorius.models import (Domain, List, MailmanApiError) from postorius.forms import * @@ -124,7 +126,7 @@ settingsform = UserPreferences(initial=mm_member.preferences) except MailmanApiError: return utils.render_api_error(request) - except HTTPError, e: + except HTTPError as e: messages.error(request, e.msg) return render_to_response( 'postorius/lists/memberoptions.html', @@ -243,7 +245,7 @@ 'Please try again.') except MailmanApiError: return utils.render_api_error(request) - except HTTPError, e: + except HTTPError as e: messages.error(request, e.msg) return redirect('list_summary', self.mailing_list.list_id) @@ -255,7 +257,7 @@ @method_decorator(login_required) def post(self, request, list_id): """ - Subscribes an email address to a mailing list via POST and + Subscribes an email address to a mailing list via POST and redirects to the `list_summary` view. """ try: @@ -285,7 +287,7 @@ 'Please try again.') except MailmanApiError: return utils.render_api_error(request) - except HTTPError, e: + except HTTPError as e: messages.error(request, e.msg) return redirect('list_summary', self.mailing_list.list_id) @@ -304,7 +306,7 @@ email) except MailmanApiError: return utils.render_api_error(request) - except ValueError, e: + except ValueError as e: messages.error(request, e) return redirect('list_summary', self.mailing_list.list_id) @@ -336,7 +338,7 @@ (email, self.mailing_list.fqdn_listname)) except MailmanApiError: return utils.render_api_error(request) - except HTTPError, e: + except HTTPError as e: messages.error(request, e) except ValidationError: messages.error(request, @@ -372,9 +374,7 @@ (email, self.mailing_list.fqdn_listname)) except MailmanApiError: return utils.render_api_error(request) - except HTTPError, e: - messages.error(request, e) - except ValueError, e: + except (HTTPError, ValueError) as e: messages.error(request, e) except ValidationError: messages.error(request, @@ -451,7 +451,7 @@ return redirect("list_summary", list_id=mailing_list.list_id) # TODO catch correct Error class: - except HTTPError, e: + except HTTPError as e: return render_to_response( 'postorius/errors/generic.html', {'error': e}, context_instance=RequestContext(request)) @@ -482,11 +482,12 @@ if request.method == 'POST': return redirect("list_summary", list_id=request.POST["list"]) else: - return render_to_response(template, - {'error': error, - 'lists': lists, - 'domain_count': len(choosable_domains)}, - context_instance=RequestContext(request)) + return render_to_response( + template, { + 'error': error, + 'lists': sorted(lists, key=lambda l: l.fqdn_listname), + 'domain_count': len(choosable_domains), + }, context_instance=RequestContext(request)) @login_required @@ -634,7 +635,7 @@ the_list.accept_message(msg_id) except MailmanApiError: return utils.render_api_error(request) - except HTTPError, e: + except HTTPError as e: messages.error(request, e.msg) return redirect('list_held_messages', the_list.list_id) messages.success(request, 'The message has been accepted.') @@ -650,7 +651,7 @@ the_list.discard_message(msg_id) except MailmanApiError: return utils.render_api_error(request) - except HTTPError, e: + except HTTPError as e: messages.error(request, e.msg) return redirect('list_held_messages', the_list.list_id) messages.success(request, 'The message has been discarded.') @@ -666,7 +667,7 @@ the_list.defer_message(msg_id) except MailmanApiError: return utils.render_api_error(request) - except HTTPError, e: + except HTTPError as e: messages.error(request, e.msg) return redirect('list_held_messages', the_list.list_id) messages.success(request, 'The message has been deferred.') @@ -682,7 +683,7 @@ the_list.reject_message(msg_id) except MailmanApiError: return utils.render_api_error(request) - except HTTPError, e: + except HTTPError as e: messages.error(request, e.msg) return redirect('list_held_messages', the_list.list_id) messages.success(request, 'The message has been rejected.') @@ -771,7 +772,7 @@ try: m_list = List.objects.get_or_404(fqdn_listname=list_id) list_settings = m_list.settings - except MailmanApiError, HTTPError: + except (MailmanApiError, HTTPError): return utils.render_api_error(request) # List settings are grouped an processed in different forms. if form_class: @@ -894,7 +895,7 @@ messages.success(request, 'All members have been unsubscribed from the list.') return redirect('list_members', mlist.list_id) - except Exception, e: + except Exception as e: messages.error(request, e) return render_to_response('postorius/lists/confirm_removeall_subscribers.html', {'list_id': mlist.list_id}, diff --git a/src/postorius/views/settings.py b/src/postorius/views/settings.py index 43e24f2..68bdf07 100644 --- a/src/postorius/views/settings.py +++ b/src/postorius/views/settings.py @@ -35,8 +35,10 @@ from django.template import Context, loader, RequestContext from django.utils.decorators import method_decorator from django.utils.translation import gettext as _ -from urllib2 import HTTPError - +try: + from urllib2 import HTTPError +except ImportError: + from urllib.error import HTTPError from postorius import utils from postorius.models import (Domain, List, Member, MailmanUser, MailmanApiError, Mailman404Error) @@ -78,7 +80,7 @@ domain.save() except MailmanApiError: return utils.render_api_error(request) - except HTTPError, e: + except HTTPError as e: messages.error(request, e) else: messages.success(request, _("New Domain registered")) @@ -101,7 +103,6 @@ _('The domain %s has been deleted.' % domain)) return redirect("domain_index") except HTTPError as e: - print e.__dict__ messages.error(request, _('The domain could not be deleted:' ' %s' % e.msg)) return redirect("domain_index") diff --git a/src/postorius/views/user.py b/src/postorius/views/user.py index 3895552..672adf5 100644 --- a/src/postorius/views/user.py +++ b/src/postorius/views/user.py @@ -31,7 +31,10 @@ from django.utils.decorators import method_decorator from django.utils.translation import gettext as _ from django.views.generic import TemplateView -from urllib2 import HTTPError +try: + from urllib2 import HTTPError +except ImportError: + from urllib.error import HTTPError from postorius import utils from postorius.models import ( @@ -106,7 +109,7 @@ messages.error(request, 'Something went wrong.') except MailmanApiError: return utils.render_api_error(request) - except HTTPError, e: + except HTTPError as e: messages.error(request, e.msg) return redirect("user_address_preferences") @@ -162,7 +165,7 @@ messages.error(request, 'Something went wrong.') except MailmanApiError: return utils.render_api_error(request) - except HTTPError, e: + except HTTPError as e: messages.error(request, e.msg) return redirect("user_subscription_preferences") @@ -290,7 +293,7 @@ user.save() except MailmanApiError: return utils.render_api_error(request) - except HTTPError, e: + except HTTPError as e: messages.error(request, e) else: messages.success(request, _("New User registered"))