diff --git a/ietf/doc/tests_draft.py b/ietf/doc/tests_draft.py index 7dc3fb16d..00aec159b 100644 --- a/ietf/doc/tests_draft.py +++ b/ietf/doc/tests_draft.py @@ -851,8 +851,15 @@ class IndividualInfoFormsTests(TestCase): # save the form without changing the email (nothing should be saved) r = self.client.post(url, dict(shepherd=plain_email.pk)) self.assertEqual(r.status_code, 302) + self.doc = Document.objects.get(name=self.docname) self.assertEqual(set(comment_events), set(self.doc.docevent_set.filter(time=self.doc.time,type="added_comment"))) + # Remove the shepherd + r = self.client.post(url, dict(shepherd='')) + self.assertEqual(r.status_code, 302) + self.doc = Document.objects.get(name=self.docname) + self.assertTrue(any(['Document shepherd changed to (None)' in x.desc for x in self.doc.docevent_set.filter(time=self.doc.time,type='added_comment')])) + # test buggy change ad = Person.objects.get(name='Aread Irector') two_answers = "%s,%s" % (plain_email, ad.email_set.all()[0]) diff --git a/ietf/doc/views_draft.py b/ietf/doc/views_draft.py index d0ec3bc8a..9a1197e30 100644 --- a/ietf/doc/views_draft.py +++ b/ietf/doc/views_draft.py @@ -966,7 +966,7 @@ def edit_shepherd(request, name): c.desc = "Document shepherd changed to "+ (doc.shepherd.person.name if doc.shepherd else "(None)") c.save() - if doc.shepherd.formatted_email() not in doc.notify: + if doc.shepherd and (doc.shepherd.formatted_email() not in doc.notify): login = request.user.person addrs = doc.notify if addrs: