Merged in [18285] from rjsparks@nostrum.com:
Better handle materials with names that end with a string that looks like a version (-nn). May address #3040.
- Legacy-Id: 18287
Note: SVN reference [18285] has been migrated to Git commit a98e00508c
This commit is contained in:
commit
072b35c6af
|
@ -448,6 +448,16 @@ class MeetingTests(TestCase):
|
|||
self.assertContains(r, meeting.number)
|
||||
self.assertContains(r, "You cannot manage the meeting materials for any groups")
|
||||
|
||||
@override_settings(MEETING_MATERIALS_SERVE_LOCALLY=True)
|
||||
def test_materials_name_endswith_hyphen_number_number(self):
|
||||
sp = SessionPresentationFactory(document__name='slides-junk-15',document__type_id='slides',document__states=[('reuse_policy','single')])
|
||||
sp.document.uploaded_filename = '%s-%s.pdf'%(sp.document.name,sp.document.rev)
|
||||
sp.document.save()
|
||||
self.write_materials_file(sp.session.meeting, sp.document, 'Fake slide contents')
|
||||
url = urlreverse("ietf.meeting.views.materials_document", kwargs=dict(document=sp.document.name,num=sp.session.meeting.number))
|
||||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
def test_proceedings(self):
|
||||
meeting = make_meeting_test_data()
|
||||
session = Session.objects.filter(meeting=meeting, group__acronym="mars").first()
|
||||
|
|
|
@ -200,7 +200,14 @@ def materials_document(request, document, num=None, ext=None):
|
|||
name, rev = document.rsplit('-', 1)
|
||||
else:
|
||||
name, rev = document, None
|
||||
doc = get_object_or_404(Document, name=name)
|
||||
# This view does not allow the use of DocAliases. Right now we are probably only creating one (identity) alias, but that may not hold in the future.
|
||||
doc = Document.objects.filter(name=name).first()
|
||||
# Handle edge case where the above name, rev splitter misidentifies the end of a document name as a revision mumber
|
||||
if not doc:
|
||||
name = name + '-' + rev
|
||||
rev = None
|
||||
doc = get_object_or_404(Document, name=name)
|
||||
|
||||
if not doc.meeting_related():
|
||||
raise Http404("Not a meeting related document")
|
||||
if not doc.session_set.filter(meeting__number=num).exists():
|
||||
|
|
Loading…
Reference in a new issue