Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ietf/meeting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
import debug # pyflakes:ignore

from ietf.doc.fields import SearchableDocumentsField
from ietf.doc.models import Document, State, DocEvent, NewRevisionDocEvent, StoredObject
from ietf.doc.models import Document, State, DocEvent, NewRevisionDocEvent, \
StoredObject, DocHistory
from ietf.doc.storage_utils import (
remove_from_storage,
retrieve_bytes,
Expand Down Expand Up @@ -258,7 +259,7 @@ def current_materials(request):
raise Http404('No such meeting')


def _get_materials_doc(name, meeting=None):
def _get_materials_doc(name, meeting=None) -> tuple[Document | DocHistory, str | None]:
"""Get meeting materials document named by name

Raises Document.DoesNotExist if a match cannot be found. If meeting is None,
Expand All @@ -279,7 +280,11 @@ def _matches_meeting(doc, meeting=None):
if "-" in name:
docname, rev = name.rsplit("-", 1)
if len(rev) == 2 and rev.isdigit():
doc = Document.objects.get(name=docname) # may raise Document.DoesNotExist
try:
doc = DocHistory.objects.get(name=docname, rev=rev)
except DocHistory.DoesNotExist:
# may raise Document.DoesNotExist
doc = Document.objects.get(name=docname, rev=rev)
if (
_matches_meeting(doc, meeting)
and rev in doc.revisions_by_newrevisionevent()
Expand Down