Skip to content

Commit c8f173f

Browse files
committed
Rewrite reading the draft list from a group agenda to be less weird,
fixing problem when agenda file is not found, which turns up when running the test-crawler on a test instance - Legacy-Id: 6060
1 parent 722b232 commit c8f173f

1 file changed

Lines changed: 19 additions & 20 deletions

File tree

ietf/meeting/views.py

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def session_agenda(request, num, session):
260260

261261
if d:
262262
agenda = d[0]
263-
content = read_agenda_file(num, agenda) or ""
263+
content = read_agenda_file(num, agenda) or "Could not read agenda file"
264264
_, ext = os.path.splitext(agenda.external_url)
265265
ext = ext.lstrip(".").lower()
266266

@@ -331,33 +331,32 @@ def read_agenda_file(num, doc):
331331
return None
332332

333333
def session_draft_list(num, session):
334-
#extensions = ["html", "htm", "txt", "HTML", "HTM", "TXT", ]
335-
result = []
336-
found = False
334+
agenda = get_object_or_404(Document,
335+
type="agenda",
336+
session__meeting__number=num,
337+
session__group__acronym=session,
338+
states=State.objects.get(type="agenda", slug="active"))
337339

338340
drafts = set()
341+
content = read_agenda_file(num, agenda)
342+
if content:
343+
drafts.update(re.findall('(draft-[-a-z0-9]*)', content))
339344

340-
for agenda in Document.objects.filter(type="agenda", session__meeting__number=num, session__group__acronym=session):
341-
content = read_agenda_file(num, agenda)
342-
if content != None:
343-
found = True
344-
drafts.update(re.findall('(draft-[-a-z0-9]*)', content))
345-
346-
if not found:
347-
raise Http404("No agenda for the %s group of IETF %s is available" % (session, num))
348-
345+
result = []
349346
for draft in drafts:
350347
try:
351-
if (re.search('-[0-9]{2}$',draft)):
348+
if re.search('-[0-9]{2}$', draft):
352349
doc_name = draft
353350
else:
354-
id = InternetDraft.objects.get(filename=draft)
355-
#doc = IdWrapper(id)
356-
doc_name = draft + "-" + id.revision
357-
result.append(doc_name)
358-
except InternetDraft.DoesNotExist:
351+
doc = Document.objects.get(filename=draft)
352+
doc_name = draft + "-" + doc.rev
353+
354+
if doc_name not in result:
355+
result.append(doc_name)
356+
except Document.DoesNotExist:
359357
pass
360-
return sorted(list(set(result)))
358+
359+
return sorted(result)
361360

362361

363362
def session_draft_tarfile(request, num, session):

0 commit comments

Comments
 (0)