Skip to content

Commit a0ed8c7

Browse files
committed
Made session minutes available with the same kind of url as session minutes: /meeting//minutes/. (Both of these need to be refined to handle multiple agendas and minutes, for groups having multiple sessions in a meeting.)
- Legacy-Id: 12398
1 parent c04c21c commit a0ed8c7

4 files changed

Lines changed: 34 additions & 17 deletions

File tree

ietf/meeting/helpers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,22 @@ def preprocess_assignments_for_agenda(assignments_queryset, meeting):
200200

201201
return assignments
202202

203-
def read_agenda_file(num, doc):
203+
def read_session_file(type, num, doc):
204204
# XXXX FIXME: the path fragment in the code below should be moved to
205205
# settings.py. The *_PATH settings should be generalized to format()
206206
# style python format, something like this:
207207
# DOC_PATH_FORMAT = { "agenda": "/foo/bar/agenda-{meeting.number}/agenda-{meeting-number}-{doc.group}*", }
208-
path = os.path.join(settings.AGENDA_PATH, "%s/agenda/%s" % (num, doc.external_url))
208+
#
209+
path = os.path.join(settings.AGENDA_PATH, "%s/%s/%s" % (num, type, doc.external_url))
209210
if os.path.exists(path):
210211
with open(path) as f:
211212
return f.read(), path
212213
else:
213214
return None, path
214215

216+
def read_agenda_file(num, doc):
217+
return read_session_file('agenda', num, doc)
218+
215219
def convert_draft_to_pdf(doc_name):
216220
inpath = os.path.join(settings.IDSUBMIT_REPOSITORY_PATH, doc_name + ".txt")
217221
outpath = os.path.join(settings.INTERNET_DRAFT_PDF_PATH, doc_name + ".pdf")

ietf/meeting/tests_views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,12 @@ def test_materials(self):
251251
self.assertEqual(r.status_code, 302)
252252
self.assertTrue(meeting.number in r["Location"])
253253

254+
# session minutes
255+
r = self.client.get(urlreverse("ietf.meeting.views.session_minutes",
256+
kwargs=dict(num=meeting.number, session=session.group.acronym)))
257+
self.assertEqual(r.status_code, 200)
258+
self.assertTrue("1. More work items underway" in unicontent(r))
259+
254260
# test with explicit meeting number in url
255261
r = self.client.get(urlreverse("ietf.meeting.views.materials", kwargs=dict(num=meeting.number)))
256262
self.assertEqual(r.status_code, 200)

ietf/meeting/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
url(r'^agenda/(?P<session>[A-Za-z0-9-]+)-drafts.pdf$', views.session_draft_pdf),
5353
url(r'^agenda/(?P<session>[A-Za-z0-9-]+)-drafts.tgz$', views.session_draft_tarfile),
5454
url(r'^agenda/(?P<session>[A-Za-z0-9-]+)/?$', views.session_agenda),
55+
url(r'^minutes/(?P<session>[A-Za-z0-9-]+)/?$', views.session_minutes),
5556
url(r'^sessions.json', ajax.sessions_json),
5657
url(r'^session/(?P<sessionid>\d+).json', ajax.session_json),
5758
url(r'^session/(?P<sessionid>\d+)/constraints.json', ajax.session_constraints),

ietf/meeting/views.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
from ietf.meeting.helpers import get_modified_from_assignments
4848
from ietf.meeting.helpers import get_wg_list, find_ads_for_meeting
4949
from ietf.meeting.helpers import get_meeting, get_schedule, agenda_permissions, get_meetings
50-
from ietf.meeting.helpers import preprocess_assignments_for_agenda, read_agenda_file
50+
from ietf.meeting.helpers import preprocess_assignments_for_agenda, read_agenda_file, read_session_file
5151
from ietf.meeting.helpers import convert_draft_to_pdf, get_earliest_session_date
5252
from ietf.meeting.helpers import can_view_interim_request, can_approve_interim_request
5353
from ietf.meeting.helpers import can_edit_interim_request
@@ -612,25 +612,25 @@ def agenda_by_type_ics(request,num=None,type=None):
612612
updated = meeting.updated()
613613
return render(request,"meeting/agenda.ics",{"schedule":schedule,"updated":updated,"assignments":assignments},content_type="text/calendar")
614614

615-
def session_agenda(request, num, session):
616-
d = Document.objects.filter(type="agenda", session__meeting__number=num)
617-
if session == "plenaryt":
615+
def session_document(request, num, acronym, type="agenda"):
616+
d = Document.objects.filter(type=type, session__meeting__number=num)
617+
if acronym == "plenaryt":
618618
d = d.filter(session__name__icontains="technical", session__slots__type="plenary")
619-
elif session == "plenaryw":
619+
elif acronym == "plenaryw":
620620
d = d.filter(session__name__icontains="admin", session__slots__type="plenary")
621621
else:
622-
d = d.filter(session__group__acronym=session)
622+
d = d.filter(session__group__acronym=acronym)
623623

624624
if d:
625-
agenda = d[0]
625+
doc = d[0]
626626
html5_preamble = "<!doctype html><html lang=en><head><meta charset=utf-8><title>%s</title></head><body>"
627627
html5_postamble = "</body></html>"
628-
content, path = read_agenda_file(num, agenda)
628+
content, path = read_session_file(type, num, doc)
629629
_, ext = os.path.splitext(path)
630630
ext = ext.lstrip(".").lower()
631631

632632
if not content:
633-
content = "Could not read agenda file '%s'" % path
633+
content = "Could not read %s file '%s'" % (type, path)
634634
return HttpResponse(content, content_type="text/plain; charset=%s"%settings.DEFAULT_CHARSET)
635635

636636
if ext == "txt":
@@ -641,23 +641,29 @@ def session_agenda(request, num, session):
641641
content=re.sub("(\r\n|\r)", "\n", content)
642642
d = PyQuery(content)
643643
d("head title").empty()
644-
d("head title").append(str(agenda))
644+
d("head title").append(str(doc))
645645
d('meta[http-equiv]').remove()
646646
content = "<!doctype html>" + d.html()
647647
else:
648-
content = "<p>Unrecognized agend file '%s'</p>" % agenda.external_url
649-
content = (html5_preamble % agenda) + content + html5_postamble
648+
content = "<p>Unrecognized %s file '%s'</p>" % (type, doc.external_url)
649+
content = (html5_preamble % doc) + content + html5_postamble
650650

651651
return HttpResponse(content)
652652

653-
raise Http404("No agenda for the %s session of IETF %s is available" % (session, num))
653+
raise Http404("No %s for the %s session of IETF %s is available" % (type, acronym, num))
654+
655+
def session_agenda(request, num, session):
656+
return session_document(request, num, acronym=session, type='agenda')
657+
658+
def session_minutes(request, num, session):
659+
return session_document(request, num, acronym=session, type='minutes')
654660

655661
def session_draft_list(num, session):
656662
try:
657-
agendas = Document.objects.filter(type="agenda",
663+
agendas = Document.objects.filter(type=type,
658664
session__meeting__number=num,
659665
session__group__acronym=session,
660-
states=State.objects.get(type="agenda", slug="active")).distinct()
666+
states=State.objects.get(type=type, slug="active")).distinct()
661667
except Document.DoesNotExist:
662668
raise Http404
663669

0 commit comments

Comments
 (0)