From c69174a483f05dcf4f51488496e6c45bcd059294 Mon Sep 17 00:00:00 2001 From: Ole Laursen Date: Thu, 3 May 2012 18:06:03 +0000 Subject: [PATCH] Generate action and review text automatically. - Legacy-Id: 4367 --- ietf/wgcharter/mails.py | 7 ++++++- ietf/wgcharter/views.py | 19 +++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ietf/wgcharter/mails.py b/ietf/wgcharter/mails.py index 2e3d3d1d6..40dc50816 100644 --- a/ietf/wgcharter/mails.py +++ b/ietf/wgcharter/mails.py @@ -48,7 +48,12 @@ def generate_ballot_writeup(request, doc): return e -def default_action_text(wg, charter, user, action): +def default_action_text(wg, charter, user): + if next_approved_revision(wg.charter.rev) == "01": + action = "Formed" + else: + action = "Rechartered" + e = WriteupDocEvent(doc=charter, by=user) e.by = user e.type = "changed_action_announcement" diff --git a/ietf/wgcharter/views.py b/ietf/wgcharter/views.py index 84ed89728..8ab7a0d1c 100644 --- a/ietf/wgcharter/views.py +++ b/ietf/wgcharter/views.py @@ -116,9 +116,13 @@ def change_state(request, name, option=None): create_ballot_if_not_open(charter, login, "r-wo-ext") else: create_ballot_if_not_open(charter, login, "r-extrev") + elif charter_state.slug == "extrev": + default_review_text(wg, charter, login) elif charter_state.slug == "iesgrev": create_ballot_if_not_open(charter, login, "approve") + default_action_text(wg, charter, login) + if charter_state.slug == "infrev" and clean["initial_time"] and clean["initial_time"] != 0: e = InitialReviewDocEvent(type="initial_review", by=login, doc=charter) e.expires = datetime.datetime.now() + datetime.timedelta(weeks=clean["initial_time"]) @@ -322,10 +326,7 @@ def announcement_text(request, name, ann): existing = charter.latest_event(WriteupDocEvent, type="changed_review_announcement") if not existing: if ann == "action": - if next_approved_revision(wg.charter.rev) == "01": - existing = default_action_text(wg, charter, login, "Formed") - else: - existing = default_action_text(wg, charter, login, "Rechartered") + existing = default_action_text(wg, charter, login) elif ann == "review": existing = default_review_text(wg, charter, login) @@ -349,10 +350,7 @@ def announcement_text(request, name, ann): if "regenerate_text" in request.POST: if ann == "action": - if next_approved_revision(wg.charter.rev) == "01": - e = default_action_text(wg, charter, login, "Formed") - else: - e = default_action_text(wg, charter, login, "Rechartered") + e = default_action_text(wg, charter, login) elif ann == "review": e = default_review_text(wg, charter, login) # make sure form has the updated text @@ -460,10 +458,7 @@ def approve(request, name): e = charter.latest_event(WriteupDocEvent, type="changed_action_announcement") if not e: - if next_approved_revision(wg.charter.rev) == "01": - announcement = default_action_text(wg, charter, login, "Formed").text - else: - announcement = default_action_text(wg, charter, login, "Rechartered").text + announcement = default_action_text(wg, charter, login).text else: announcement = e.text