Port mailinglists to new schema

- Legacy-Id: 6782
This commit is contained in:
Ole Laursen 2013-12-03 18:55:26 +00:00
parent 26ec475d89
commit 6c57fe496f
5 changed files with 52 additions and 59 deletions

View file

@ -1,38 +1,31 @@
# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# * Neither the name of the Nokia Corporation and/or its
# subsidiary(-ies) nor the names of its contributors may be used
# to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from django.core.urlresolvers import reverse as urlreverse
from ietf.utils.test_utils import SimpleUrlTestCase
from pyquery import PyQuery
from ietf.utils.test_utils import TestCase
from ietf.utils.test_data import make_test_data
from ietf.utils.mail import outbox
class MailingListTests(TestCase):
def test_groups(self):
draft = make_test_data()
group = draft.group
url = urlreverse("ietf.mailinglists.views.groups")
# only those with an archive
group.list_archive = ""
group.save()
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertEqual(len(q(".group-archives a:contains(\"%s\")" % group.acronym)), 0)
# successful get
group.list_archive = "https://example.com/foo"
group.save()
r = self.client.get(url)
q = PyQuery(r.content)
self.assertEqual(len(q(".group-archives a:contains(\"%s\")" % group.acronym)), 1)
class MailingListsUrlTestCase(SimpleUrlTestCase):
def testUrls(self):
self.doTestUrls(__file__)

View file

@ -1,4 +0,0 @@
200 /list/wg/
301 /list/nonwg/
301 /list/nonwg/update/
301 /list/request/

View file

@ -1,14 +1,9 @@
# Copyright The IETF Trust 2007, All Rights Reserved
from django.conf.urls.defaults import patterns
from ietf.idtracker.models import IETFWG
http_archive_wg_queryset = IETFWG.objects.filter(email_archive__startswith='http')
urlpatterns = patterns('django.views.generic.list_detail',
(r'^wg/$', 'object_list', { 'queryset': http_archive_wg_queryset, 'template_name': 'mailinglists/wgwebmail_list.html' }),
)
urlpatterns += patterns('',
urlpatterns = patterns('',
(r'^wg/$', 'ietf.mailinglists.views.groups'),
(r'^nonwg/$', 'django.views.generic.simple.redirect_to', { 'url': 'http://www.ietf.org/list/nonwg.html'}),
(r'^nonwg/update/$', 'django.views.generic.simple.redirect_to', { 'url': 'http://www.ietf.org/list/nonwg.html'}),
(r'^request/$', 'django.views.generic.simple.redirect_to', { 'url': 'http://www.ietf.org/list/request.html' }),

View file

@ -1,2 +1,12 @@
# Copyright The IETF Trust 2007, All Rights Reserved
from ietf.group.models import Group
from django.shortcuts import render_to_response
from django.template import RequestContext
def groups(request):
groups = Group.objects.filter(type__in=("wg", "rg"), list_archive__startswith='http').order_by("acronym")
return render_to_response("mailinglists/group_archives.html", { "groups": groups },
context_instance=RequestContext(request))

View file

@ -11,21 +11,20 @@
charters for more information about the mailing lists and archives
of specific working groups. Charters for active working groups are
available on
the <a href="/wg/">Active
IETF Working Groups</a> Web page. Charters for concluded working
groups are available on
the <a href="/wg/">Active IETF Working Groups</a> Web page.
Charters for concluded working groups are available on
the <a href="http://www.ietf.org/wg/concluded/index.html">Concluded
Working Groups</a> Web page.</p>
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<th style="text-align:left;padding-right:2em;">Acronym</th><th style="text-align:left;">Name</th>
</tr>
{% for wg in object_list|dictsort:"group_acronym.acronym" %}
<tr>
<td><a href="{{ wg.email_archive|escape }}">{{ wg|escape }}</a></td>
<td>{{ wg.group_acronym.name|escape }}</td>
</tr>
{% endfor %}
<table class="group-archives" cellpadding="2" cellspacing="0" border="0">
<tr>
<th style="text-align:left;padding-right:2em;">Acronym</th><th style="text-align:left;">Name</th>
</tr>
{% for group in groups %}
<tr>
<td><a href="{{ group.list_archive }}">{{ group.acronym }}</a></td>
<td>{{ group.name }}</td>
</tr>
{% endfor %}
</table>
{% endblock %}