Merged in [13336] from rcross@amsl.com:
Fix issue where deferring a ballot causes 500 error in Telechat app. Fixes #1342.
- Legacy-Id: 13338
Note: SVN reference [13336] has been migrated to Git commit 7542e8daa3
This commit is contained in:
commit
83ed53e7a9
|
@ -53,6 +53,16 @@ class SecrTelechatTestCase(TestCase):
|
|||
self.assertEqual(q("#telechat-positions-table").find("th:contains('Recuse')").length,1)
|
||||
self.assertEqual(q("#telechat-positions-table").find("th:contains('No Record')").length,1)
|
||||
|
||||
def test_doc_detail_draft_invalid(self):
|
||||
'''Test using a document not on telechat agenda'''
|
||||
draft = make_test_data()
|
||||
date = get_next_telechat_date().strftime('%Y-%m-%d')
|
||||
url = reverse('ietf.secr.telechat.views.doc_detail', kwargs={'date':date, 'name':draft.name})
|
||||
self.client.login(username="secretary", password="secretary+password")
|
||||
response = self.client.get(url, follow=True)
|
||||
self.assertRedirects(response, reverse('ietf.secr.telechat.views.doc', kwargs={'date':date}))
|
||||
self.assertTrue('not on the Telechat agenda' in response.content)
|
||||
|
||||
def test_doc_detail_charter(self):
|
||||
make_test_data()
|
||||
by=Person.objects.get(name="(System)")
|
||||
|
|
|
@ -124,6 +124,15 @@ def get_first_doc(agenda):
|
|||
|
||||
return None
|
||||
|
||||
def is_doc_on_telechat(doc,date):
|
||||
'''Returns true if the document is on the Telechat agenda for date=date.
|
||||
Where date is a string in the format YYYY-MM-DD
|
||||
'''
|
||||
if doc.telechat_date() and doc.telechat_date().strftime("%Y-%m-%d") == date:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
# -------------------------------------------------
|
||||
# View Functions
|
||||
# -------------------------------------------------
|
||||
|
@ -162,6 +171,11 @@ def doc_detail(request, date, name):
|
|||
changes to ballot positions and document state.
|
||||
'''
|
||||
doc = get_object_or_404(Document, docalias__name=name)
|
||||
if not is_doc_on_telechat(doc, date):
|
||||
messages.warning(request, 'Dcoument: {name} is not on the Telechat agenda for {date}'.format(
|
||||
name=doc.name,
|
||||
date=date))
|
||||
return redirect('ietf.secr.telechat.views.doc', date=date)
|
||||
|
||||
# As of Datatracker v4.32, Conflict Review (conflrev) Document Types can
|
||||
# be added to the Telechat agenda. If Document.type_id == draft use draft-iesg
|
||||
|
|
Loading…
Reference in a new issue