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
This commit is contained in:
parent
c04c21c34b
commit
a0ed8c7694
|
@ -200,18 +200,22 @@ def preprocess_assignments_for_agenda(assignments_queryset, meeting):
|
|||
|
||||
return assignments
|
||||
|
||||
def read_agenda_file(num, doc):
|
||||
def read_session_file(type, num, doc):
|
||||
# XXXX FIXME: the path fragment in the code below should be moved to
|
||||
# settings.py. The *_PATH settings should be generalized to format()
|
||||
# style python format, something like this:
|
||||
# DOC_PATH_FORMAT = { "agenda": "/foo/bar/agenda-{meeting.number}/agenda-{meeting-number}-{doc.group}*", }
|
||||
path = os.path.join(settings.AGENDA_PATH, "%s/agenda/%s" % (num, doc.external_url))
|
||||
#
|
||||
path = os.path.join(settings.AGENDA_PATH, "%s/%s/%s" % (num, type, doc.external_url))
|
||||
if os.path.exists(path):
|
||||
with open(path) as f:
|
||||
return f.read(), path
|
||||
else:
|
||||
return None, path
|
||||
|
||||
def read_agenda_file(num, doc):
|
||||
return read_session_file('agenda', num, doc)
|
||||
|
||||
def convert_draft_to_pdf(doc_name):
|
||||
inpath = os.path.join(settings.IDSUBMIT_REPOSITORY_PATH, doc_name + ".txt")
|
||||
outpath = os.path.join(settings.INTERNET_DRAFT_PDF_PATH, doc_name + ".pdf")
|
||||
|
|
|
@ -251,6 +251,12 @@ class MeetingTests(TestCase):
|
|||
self.assertEqual(r.status_code, 302)
|
||||
self.assertTrue(meeting.number in r["Location"])
|
||||
|
||||
# session minutes
|
||||
r = self.client.get(urlreverse("ietf.meeting.views.session_minutes",
|
||||
kwargs=dict(num=meeting.number, session=session.group.acronym)))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertTrue("1. More work items underway" in unicontent(r))
|
||||
|
||||
# test with explicit meeting number in url
|
||||
r = self.client.get(urlreverse("ietf.meeting.views.materials", kwargs=dict(num=meeting.number)))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
|
|
@ -52,6 +52,7 @@ type_ietf_only_patterns = [
|
|||
url(r'^agenda/(?P<session>[A-Za-z0-9-]+)-drafts.pdf$', views.session_draft_pdf),
|
||||
url(r'^agenda/(?P<session>[A-Za-z0-9-]+)-drafts.tgz$', views.session_draft_tarfile),
|
||||
url(r'^agenda/(?P<session>[A-Za-z0-9-]+)/?$', views.session_agenda),
|
||||
url(r'^minutes/(?P<session>[A-Za-z0-9-]+)/?$', views.session_minutes),
|
||||
url(r'^sessions.json', ajax.sessions_json),
|
||||
url(r'^session/(?P<sessionid>\d+).json', ajax.session_json),
|
||||
url(r'^session/(?P<sessionid>\d+)/constraints.json', ajax.session_constraints),
|
||||
|
|
|
@ -47,7 +47,7 @@ from ietf.meeting.helpers import get_all_assignments_from_schedule
|
|||
from ietf.meeting.helpers import get_modified_from_assignments
|
||||
from ietf.meeting.helpers import get_wg_list, find_ads_for_meeting
|
||||
from ietf.meeting.helpers import get_meeting, get_schedule, agenda_permissions, get_meetings
|
||||
from ietf.meeting.helpers import preprocess_assignments_for_agenda, read_agenda_file
|
||||
from ietf.meeting.helpers import preprocess_assignments_for_agenda, read_agenda_file, read_session_file
|
||||
from ietf.meeting.helpers import convert_draft_to_pdf, get_earliest_session_date
|
||||
from ietf.meeting.helpers import can_view_interim_request, can_approve_interim_request
|
||||
from ietf.meeting.helpers import can_edit_interim_request
|
||||
|
@ -612,25 +612,25 @@ def agenda_by_type_ics(request,num=None,type=None):
|
|||
updated = meeting.updated()
|
||||
return render(request,"meeting/agenda.ics",{"schedule":schedule,"updated":updated,"assignments":assignments},content_type="text/calendar")
|
||||
|
||||
def session_agenda(request, num, session):
|
||||
d = Document.objects.filter(type="agenda", session__meeting__number=num)
|
||||
if session == "plenaryt":
|
||||
def session_document(request, num, acronym, type="agenda"):
|
||||
d = Document.objects.filter(type=type, session__meeting__number=num)
|
||||
if acronym == "plenaryt":
|
||||
d = d.filter(session__name__icontains="technical", session__slots__type="plenary")
|
||||
elif session == "plenaryw":
|
||||
elif acronym == "plenaryw":
|
||||
d = d.filter(session__name__icontains="admin", session__slots__type="plenary")
|
||||
else:
|
||||
d = d.filter(session__group__acronym=session)
|
||||
d = d.filter(session__group__acronym=acronym)
|
||||
|
||||
if d:
|
||||
agenda = d[0]
|
||||
doc = d[0]
|
||||
html5_preamble = "<!doctype html><html lang=en><head><meta charset=utf-8><title>%s</title></head><body>"
|
||||
html5_postamble = "</body></html>"
|
||||
content, path = read_agenda_file(num, agenda)
|
||||
content, path = read_session_file(type, num, doc)
|
||||
_, ext = os.path.splitext(path)
|
||||
ext = ext.lstrip(".").lower()
|
||||
|
||||
if not content:
|
||||
content = "Could not read agenda file '%s'" % path
|
||||
content = "Could not read %s file '%s'" % (type, path)
|
||||
return HttpResponse(content, content_type="text/plain; charset=%s"%settings.DEFAULT_CHARSET)
|
||||
|
||||
if ext == "txt":
|
||||
|
@ -641,23 +641,29 @@ def session_agenda(request, num, session):
|
|||
content=re.sub("(\r\n|\r)", "\n", content)
|
||||
d = PyQuery(content)
|
||||
d("head title").empty()
|
||||
d("head title").append(str(agenda))
|
||||
d("head title").append(str(doc))
|
||||
d('meta[http-equiv]').remove()
|
||||
content = "<!doctype html>" + d.html()
|
||||
else:
|
||||
content = "<p>Unrecognized agend file '%s'</p>" % agenda.external_url
|
||||
content = (html5_preamble % agenda) + content + html5_postamble
|
||||
content = "<p>Unrecognized %s file '%s'</p>" % (type, doc.external_url)
|
||||
content = (html5_preamble % doc) + content + html5_postamble
|
||||
|
||||
return HttpResponse(content)
|
||||
|
||||
raise Http404("No agenda for the %s session of IETF %s is available" % (session, num))
|
||||
raise Http404("No %s for the %s session of IETF %s is available" % (type, acronym, num))
|
||||
|
||||
def session_agenda(request, num, session):
|
||||
return session_document(request, num, acronym=session, type='agenda')
|
||||
|
||||
def session_minutes(request, num, session):
|
||||
return session_document(request, num, acronym=session, type='minutes')
|
||||
|
||||
def session_draft_list(num, session):
|
||||
try:
|
||||
agendas = Document.objects.filter(type="agenda",
|
||||
agendas = Document.objects.filter(type=type,
|
||||
session__meeting__number=num,
|
||||
session__group__acronym=session,
|
||||
states=State.objects.get(type="agenda", slug="active")).distinct()
|
||||
states=State.objects.get(type=type, slug="active")).distinct()
|
||||
except Document.DoesNotExist:
|
||||
raise Http404
|
||||
|
||||
|
|
Loading…
Reference in a new issue