From 0496ee1b738995862e561c3b4cb3238a3640e2dc Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Mon, 27 Oct 2014 21:27:49 +0000 Subject: [PATCH] Allow removing a document shepherd, and test that it works. Fixes bug #1509. Commit ready for merge. - Legacy-Id: 8505 --- ietf/doc/tests_draft.py | 7 +++++++ ietf/doc/views_draft.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) 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: