diff --git a/src/postorius/urls.py b/src/postorius/urls.py index 606d37b..d09d921 100644 --- a/src/postorius/urls.py +++ b/src/postorius/urls.py @@ -20,101 +20,73 @@ from django.contrib.auth.views import login as login_view from django.contrib.auth.views import logout as logout_view -from postorius.views import * +from postorius.views import list as list_views +from postorius.views import user as user_views +from postorius.views import domain as domain_views -per_list_urlpatterns = patterns('postorius.views', - url(r'^csv_view/$', - 'csv_view', name='csv_view'), - url(r'^members/options/(?P[^/]+)/$', - list_member_options, - name='list_member_options'), - url(r'^members/(?P\w+)/$', - 'list_members_view', name='list_members'), - url(r'^$', - ListSummaryView.as_view( - ), name='list_summary'), - url(r'^subscribe$', - ListSubscribeView.as_view( - ), name='list_subscribe'), - url(r'^change_subscription$', - ChangeSubscriptionView.as_view(), - name='change_subscription'), - url(r'^unsubscribe/(?P[^/]+)$', - ListUnsubscribeView.as_view( - ), name='list_unsubscribe'), - url(r'^subscription_requests$', - 'list_subscription_requests', - name='list_subscription_requests'), - url(r'^handle_subscription_request/(?P[^/]+)/(?P[accept|reject|discard|defer]+)$', - 'handle_subscription_request', - name='handle_subscription_request'), - url(r'^mass_subscribe/$', - 'list_mass_subscribe', name='mass_subscribe'), - url(r'^mass_removal/$', - ListMassRemovalView.as_view( - ), name='mass_removal'), - url(r'^bans/$', - 'list_bans', name='list_bans'), - url(r'^delete$', - 'list_delete', name='list_delete'), - url(r'^held_messages/(?P[^/]+)/' - 'accept$', 'accept_held_message', - name='accept_held_message'), - url(r'^held_messages/(?P[^/]+)/' - 'discard$', 'discard_held_message', - name='discard_held_message'), - url(r'^held_messages/(?P[^/]+)/' - 'defer$', 'defer_held_message', - name='defer_held_message'), - url(r'^held_messages/(?P[^/]+)/' - 'reject$', 'reject_held_message', - name='reject_held_message'), - url(r'^held_messages$', - 'list_moderation', - name='list_held_messages'), - url(r'^remove/(?P[^/]+)/' - '(?P
[^/]+)', - 'remove_role', name='remove_role'), - url(r'^settings/(?P[^/]+)?$', - 'list_settings', - name='list_settings'), - url(r'^unsubscribe_all$', - 'remove_all_subscribers', name='unsubscribe_all'), - ) +list_patterns = [ + url(r'^csv_view/$', list_views.csv_view, name='csv_view'), + url(r'^members/options/(?P[^/]+)/$', list_views.list_member_options, + name='list_member_options'), + url(r'^members/(?P\w+)/$', list_views.list_members_view, name='list_members'), + url(r'^$', list_views.ListSummaryView.as_view(), name='list_summary'), + url(r'^subscribe$', list_views.ListSubscribeView.as_view(), name='list_subscribe'), + url(r'^change_subscription$', list_views.ChangeSubscriptionView.as_view(), + name='change_subscription'), + url(r'^unsubscribe/(?P[^/]+)$', list_views.ListUnsubscribeView.as_view(), + name='list_unsubscribe'), + url(r'^subscription_requests$', list_views.list_subscription_requests, + name='list_subscription_requests'), + url(r'^handle_subscription_request/(?P[^/]+)/(?P[accept|reject|discard|defer]+)$', + list_views.handle_subscription_request, name='handle_subscription_request'), + url(r'^mass_subscribe/$', list_views.list_mass_subscribe, name='mass_subscribe'), + url(r'^mass_removal/$', list_views.ListMassRemovalView.as_view(), name='mass_removal'), + url(r'^delete$', list_views.list_delete, name='list_delete'), + url(r'^held_messages/(?P[^/]+)/accept$', list_views.accept_held_message, + name='accept_held_message'), + url(r'^held_messages/(?P[^/]+)/discard$', list_views.discard_held_message, + name='discard_held_message'), + url(r'^held_messages/(?P[^/]+)/defer$', list_views.defer_held_message, + name='defer_held_message'), + url(r'^held_messages/(?P[^/]+)/reject$', list_views.reject_held_message, + name='reject_held_message'), + url(r'^held_messages$', list_views.list_moderation, name='list_held_messages'), + url(r'^bans/$', list_views.list_bans, name='list_bans'), + url(r'^remove/(?P[^/]+)/(?P
[^/]+)', list_views.remove_role, name='remove_role'), + url(r'^settings/(?P[^/]+)?$', list_views.list_settings, name='list_settings'), + url(r'^unsubscribe_all$', list_views.remove_all_subscribers, name='unsubscribe_all'), +] -urlpatterns = patterns( - 'postorius.views', - (r'^$', 'list_index'), - # /account/ +urlpatterns = [ + url(r'^$', list_views.list_index), url(r'^accounts/login/$', login_view, {"template_name": "postorius/login.html"}, name='user_login'), url(r'^accounts/logout/$', logout_view, name='user_logout'), - url(r'^accounts/profile/$', 'user_profile', name='user_profile'), - url(r'^accounts/subscriptions/$', UserSubscriptionsView.as_view(), + url(r'^accounts/profile/$', user_views.user_profile, name='user_profile'), + url(r'^accounts/subscriptions/$', user_views.UserSubscriptionsView.as_view(), name='user_subscriptions'), - url(r'^accounts/per-address-preferences/$', - UserAddressPreferencesView.as_view(), name='user_address_preferences'), - url(r'^accounts/per-subscription-preferences/$', # if this URL changes, update Mailman's Member.options_url - UserSubscriptionPreferencesView.as_view( - ), name='user_subscription_preferences'), - url(r'^accounts/mailmansettings/$', - UserMailmanSettingsView.as_view(), + url(r'^accounts/per-address-preferences/$', user_views.UserAddressPreferencesView.as_view(), + name='user_address_preferences'), + # if this URL changes, update Mailman's Member.options_url + url(r'^accounts/per-subscription-preferences/$', + user_views.UserSubscriptionPreferencesView.as_view(), + name='user_subscription_preferences'), + url(r'^accounts/mailmansettings/$', user_views.UserMailmanSettingsView.as_view(), name='user_mailmansettings'), - url(r'^accounts/list-options/(?P[^/]+)/$', user_list_options, + url(r'^accounts/list-options/(?P[^/]+)/$', user_views.user_list_options, name='user_list_options'), # /domains/ - url(r'^domains/$', 'domain_index', name='domain_index'), - url(r'^domains/new/$', 'domain_new', name='domain_new'), - url(r'^domains/(?P[^/]+)/delete$', - 'domain_delete', name='domain_delete'), + url(r'^domains/$', domain_views.domain_index, name='domain_index'), + url(r'^domains/new/$', domain_views.domain_new, name='domain_new'), + url(r'^domains/(?P[^/]+)/delete$', domain_views.domain_delete, name='domain_delete'), # /lists/ - url(r'^lists/$', 'list_index', name='list_index'), - url(r'^lists/new/$', 'list_new', name='list_new'), - url(r'^lists/(?P[^/]+)/', include(per_list_urlpatterns)), - url(r'^users/address_activation/$', - AddressActivationView.as_view(), + url(r'^lists/$', list_views.list_index, name='list_index'), + url(r'^lists/new/$', list_views.list_new, name='list_new'), + url(r'^lists/(?P[^/]+)/', include(list_patterns)), + url(r'^users/address_activation/$', user_views.AddressActivationView.as_view(), name='address_activation'), url(r'^users/address_activation/(?P[A-Za-z0-9]{40})/$', - 'address_activation_link', name='address_activation_link'), -) + user_views.address_activation_link, + name='address_activation_link'), +] diff --git a/src/postorius/views/__init__.py b/src/postorius/views/__init__.py index b087541..e69de29 100644 --- a/src/postorius/views/__init__.py +++ b/src/postorius/views/__init__.py @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 1998-2015 by the Free Software Foundation, Inc. -# -# This file is part of Postorius. -# -# Postorius 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. -# -# Postorius 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 -# Postorius. If not, see . - -from postorius.views.list import * -from postorius.views.domain import * -from postorius.views.user import *