Merge pull request #7714 from jennifer-richards/agenda-upload-error
fix: handle missing minutes / agenda file cleanly
This commit is contained in:
commit
7b82e60552
|
@ -6246,6 +6246,12 @@ class MaterialsTests(TestCase):
|
||||||
q = PyQuery(r.content)
|
q = PyQuery(r.content)
|
||||||
self.assertTrue(q('form input[type="checkbox"]'))
|
self.assertTrue(q('form input[type="checkbox"]'))
|
||||||
|
|
||||||
|
# test not submitting a file
|
||||||
|
r = self.client.post(url, dict(submission_method="upload"))
|
||||||
|
self.assertEqual(r.status_code, 200)
|
||||||
|
q = PyQuery(r.content)
|
||||||
|
self.assertTrue(q("form .is-invalid"))
|
||||||
|
|
||||||
test_file = BytesIO(b'this is some text for a test')
|
test_file = BytesIO(b'this is some text for a test')
|
||||||
test_file.name = "not_really.json"
|
test_file.name = "not_really.json"
|
||||||
r = self.client.post(url,dict(submission_method="upload",file=test_file))
|
r = self.client.post(url,dict(submission_method="upload",file=test_file))
|
||||||
|
|
|
@ -2790,7 +2790,8 @@ class UploadOrEnterAgendaForm(UploadAgendaForm):
|
||||||
def clean_file(self):
|
def clean_file(self):
|
||||||
submission_method = self.cleaned_data.get("submission_method")
|
submission_method = self.cleaned_data.get("submission_method")
|
||||||
if submission_method == "upload":
|
if submission_method == "upload":
|
||||||
return super().clean_file()
|
if self.cleaned_data.get("file", None) is not None:
|
||||||
|
return super().clean_file()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
|
|
Loading…
Reference in a new issue