Added a page that lists all the advertised non-wg mailing lists, based
on data fetched from mailman by a cronjob running the import_mailman_listinfo managemnt command. Fixes issue #2438. - Legacy-Id: 14587
This commit is contained in:
parent
2687c8d839
commit
0c1105f4bb
|
@ -37,9 +37,13 @@ def import_mailman_listinfo(verbosity=0):
|
||||||
for name in names:
|
for name in names:
|
||||||
mlist = MailList.MailList(name, lock=False)
|
mlist = MailList.MailList(name, lock=False)
|
||||||
note("List: %s" % mlist.internal_name())
|
note("List: %s" % mlist.internal_name())
|
||||||
|
sys.exit()
|
||||||
if mlist.advertised:
|
if mlist.advertised:
|
||||||
description = mlist.description.decode('latin1')[:256]
|
description = mlist.description.decode('latin1')[:256]
|
||||||
mmlist, created = List.objects.get_or_create(name=mlist.real_name, description=description, advertised=mlist.advertised)
|
mmlist, created = List.objects.get_or_create(name=mlist.real_name)
|
||||||
|
mmlist.description = description
|
||||||
|
mmlist.advertised = mlist.advertised
|
||||||
|
mmlist.save()
|
||||||
# The following calls return lowercased addresses
|
# The following calls return lowercased addresses
|
||||||
members = mlist.getRegularMemberKeys() + mlist.getDigestMemberKeys()
|
members = mlist.getRegularMemberKeys() + mlist.getDigestMemberKeys()
|
||||||
members = [ m for m in members if mlist.getDeliveryStatus(m) == MemberAdaptor.ENABLED ]
|
members = [ m for m in members if mlist.getDeliveryStatus(m) == MemberAdaptor.ENABLED ]
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
# Copyright The IETF Trust 2016, All Rights Reserved
|
# Copyright The IETF Trust 2016, All Rights Reserved
|
||||||
|
|
||||||
from django.db import models
|
|
||||||
|
from django.conf import settings
|
||||||
from django.core.validators import validate_email
|
from django.core.validators import validate_email
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
from ietf.person.models import Person
|
from ietf.person.models import Person
|
||||||
|
|
||||||
|
@ -11,6 +13,8 @@ class List(models.Model):
|
||||||
advertised = models.BooleanField(default=True)
|
advertised = models.BooleanField(default=True)
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return "<List: %s>" % self.name
|
return "<List: %s>" % self.name
|
||||||
|
def info_url(self):
|
||||||
|
return settings.MAILING_LIST_INFO_URL % {'list_addr': self.name }
|
||||||
|
|
||||||
class Subscribed(models.Model):
|
class Subscribed(models.Model):
|
||||||
time = models.DateTimeField(auto_now_add=True)
|
time = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
# Copyright The IETF Trust 2016, All Rights Reserved
|
# Copyright The IETF Trust 2016, All Rights Reserved
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
from django.urls import reverse as urlreverse
|
from __future__ import unicode_literals, print_function
|
||||||
|
|
||||||
from pyquery import PyQuery
|
from pyquery import PyQuery
|
||||||
|
|
||||||
|
from django.urls import reverse as urlreverse
|
||||||
|
|
||||||
|
import debug # pyflakes:ignore
|
||||||
|
|
||||||
|
from ietf.mailinglists.factories import ListFactory
|
||||||
from ietf.utils.test_utils import TestCase
|
from ietf.utils.test_utils import TestCase
|
||||||
from ietf.utils.test_data import make_test_data
|
from ietf.utils.test_data import make_test_data
|
||||||
|
|
||||||
|
@ -30,3 +35,15 @@ class MailingListTests(TestCase):
|
||||||
self.assertEqual(len(q("#content a:contains(\"%s\")" % group.acronym)), 1)
|
self.assertEqual(len(q("#content a:contains(\"%s\")" % group.acronym)), 1)
|
||||||
|
|
||||||
|
|
||||||
|
def test_nonwg(self):
|
||||||
|
lists = ListFactory.create_batch(7)
|
||||||
|
url = urlreverse("ietf.mailinglists.views.nonwg")
|
||||||
|
|
||||||
|
r = self.client.get(url)
|
||||||
|
for l in lists:
|
||||||
|
if l.advertised:
|
||||||
|
self.assertContains(r, l.name)
|
||||||
|
self.assertContains(r, l.description)
|
||||||
|
else:
|
||||||
|
self.assertNotContains(r, l.name, html=True)
|
||||||
|
self.assertNotContains(r, l.description, html=True)
|
||||||
|
|
|
@ -6,8 +6,8 @@ from ietf.mailinglists import views
|
||||||
from ietf.utils.urls import url
|
from ietf.utils.urls import url
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^wg/$', views.groups),
|
url(r'^wg/?$', views.groups),
|
||||||
url(r'^nonwg/$', RedirectView.as_view(url='https://www.ietf.org/list/nonwg.html', permanent=True)),
|
url(r'^nonwg/?$', views.nonwg),
|
||||||
url(r'^nonwg/update/$', RedirectView.as_view(url='https://www.ietf.org/list/nonwg.html', permanent=True)),
|
url(r'^nonwg/update/?$', RedirectView.as_view(url='https://www.ietf.org/list/nonwg.html', permanent=True)),
|
||||||
url(r'^request/$', RedirectView.as_view(url='https://www.ietf.org/list/request.html', permanent=True)),
|
url(r'^request/?$', RedirectView.as_view(url='https://www.ietf.org/list/request.html', permanent=True)),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,10 +1,33 @@
|
||||||
# Copyright The IETF Trust 2007, All Rights Reserved
|
# Copyright The IETF Trust 2007, All Rights Reserved
|
||||||
|
|
||||||
from ietf.group.models import Group
|
import re
|
||||||
|
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
import debug # pyflakes:ignore
|
||||||
|
|
||||||
|
from ietf.group.models import Group
|
||||||
|
from ietf.mailinglists.models import List
|
||||||
|
|
||||||
def groups(request):
|
def groups(request):
|
||||||
groups = Group.objects.filter(type__in=("wg", "rg", "ag"), list_archive__startswith='http').order_by("acronym")
|
groups = Group.objects.filter(type__in=("wg", "rg", "ag"), list_archive__startswith='http').order_by("acronym")
|
||||||
|
|
||||||
return render(request, "mailinglists/group_archives.html", { "groups": groups } )
|
return render(request, "mailinglists/group_archives.html", { "groups": groups } )
|
||||||
|
|
||||||
|
def nonwg(request):
|
||||||
|
groups = Group.objects.filter(type__in=("wg", "rg")).order_by("acronym")
|
||||||
|
|
||||||
|
#urls = [ g.list_archive for g in groups if '.ietf.org' in g.list_archive ]
|
||||||
|
|
||||||
|
wg_lists = set()
|
||||||
|
for g in groups:
|
||||||
|
wg_lists.add(g.acronym)
|
||||||
|
match = re.search(r'^(https?://mailarchive.ietf.org/arch/(browse/|search/\?email-list=))(?P<name>[^/]*)/?$', g.list_archive)
|
||||||
|
if match:
|
||||||
|
wg_lists.add(match.group('name').lower())
|
||||||
|
|
||||||
|
lists = List.objects.filter(advertised=True)
|
||||||
|
#debug.show('lists.count()')
|
||||||
|
lists = lists.exclude(name__in=wg_lists).order_by('name')
|
||||||
|
#debug.show('lists.count()')
|
||||||
|
return render(request, "mailinglists/nonwg.html", { "lists": lists } )
|
||||||
|
|
27
ietf/templates/mailinglists/nonwg.html
Normal file
27
ietf/templates/mailinglists/nonwg.html
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{# Copyright The IETF Trust 2015, All Rights Reserved #}
|
||||||
|
{% load origin %}
|
||||||
|
|
||||||
|
{% block title %}Non-Working Group email lists{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% origin %}
|
||||||
|
<h1>Non-Working Group email lists</h1>
|
||||||
|
|
||||||
|
<table class="table table-condensed table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th><th>Description</th><th>List Info</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for list in lists %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ list.name.lower }}</td>
|
||||||
|
<td>{{ list.description }}</td>
|
||||||
|
<td><a href="{{ list.info_url }}">{{ list.info_url.lower }}</a></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
Loading…
Reference in a new issue