Summary: Be more careful with generating announcements for charters so

they are not saved unless we're in a POST
 - Legacy-Id: 10141
This commit is contained in:
Ole Laursen 2015-10-07 10:42:31 +00:00
parent dfdd670c1a
commit 43445307b1
3 changed files with 12 additions and 7 deletions

View file

@ -359,7 +359,8 @@ class EditCharterTests(TestCase):
url = urlreverse('ietf.doc.views_charter.ballot_writeupnotes', kwargs=dict(name=charter.name))
login_testing_unauthorized(self, "secretary", url)
default_action_text(draft.group, charter, by)
e = default_action_text(draft.group, charter, by)
e.save()
# normal get
r = self.client.get(url)

View file

@ -175,7 +175,7 @@ def default_action_text(group, charter, by):
action_type=action,
))
e.save()
# caller is responsible for saving, if necessary
return e
def default_review_text(group, charter, by):
@ -195,7 +195,7 @@ def default_review_text(group, charter, by):
review_type="new" if group.state_id == "proposed" else "recharter",
)
)
e.save()
# caller is responsible for saving, if necessary
return e
def generate_issue_ballot_mail(request, doc, ballot):

View file

@ -149,8 +149,10 @@ def change_state(request, name, option=None):
create_ballot_if_not_open(charter, by, "r-wo-ext")
else:
create_ballot_if_not_open(charter, by, "r-extrev")
default_review_text(group, charter, by)
default_action_text(group, charter, by)
e = default_review_text(group, charter, by)
e.save()
e = default_action_text(group, charter, by)
e.save()
elif charter_state.slug == "iesgrev":
create_ballot_if_not_open(charter, by, "approve")
elif charter_state.slug == "approved":
@ -486,8 +488,8 @@ def announcement_text(request, name, ann):
e.desc = "%s %s text was changed" % (group.type.name, ann)
e.text = t
e.save()
charter.save_with_history([e])
elif existing.pk == None:
existing.save()
if request.GET.get("next", "") == "approve":
return redirect('charter_approve', name=charter.canonical_name())
@ -497,8 +499,10 @@ def announcement_text(request, name, ann):
if "regenerate_text" in request.POST:
if ann == "action":
e = default_action_text(group, charter, by)
e.save()
elif ann == "review":
e = default_review_text(group, charter, by)
e.save()
# make sure form has the updated text
form = AnnouncementTextForm(initial=dict(announcement_text=e.text))