From c20d969eafbca061a8660bfbcaea13f7ad845cbc Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Wed, 10 Nov 2010 09:21:09 +0000 Subject: [PATCH] Merged [2673] from rjsparks@nostrum.com: Refined the email sent when an position changes. Added a helper to Position to get the current position description as a string This fixes issue #547. - Legacy-Id: 2674 Note: SVN reference [2673] has been migrated to Git commit 770429b398a9480a5367066d43d9c503d8fdae4a --- ietf/idrfc/views_ballot.py | 8 ++++++-- ietf/idtracker/models.py | 14 ++++++++++++++ ietf/templates/idrfc/ballot_comment_mail.txt | 5 ++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ietf/idrfc/views_ballot.py b/ietf/idrfc/views_ballot.py index 0ecd2c5b0..ab4a94e1a 100644 --- a/ietf/idrfc/views_ballot.py +++ b/ietf/idrfc/views_ballot.py @@ -228,11 +228,15 @@ def send_ballot_comment(request, name): c = comment.text subj.append("COMMENT") + ad_name = str(ad) ad_name_genitive = ad_name + "'" if ad_name.endswith('s') else ad_name + "'s" - subject = "%s %s on %s" % (ad_name_genitive, " and ".join(subj), doc.filename + '-' + doc.revision_display()) + subject = "%s %s on %s" % (ad_name_genitive, pos.name() if pos else "No Position" , doc.filename + '-' + doc.revision_display()) + if subj: + subject += ": (with "+" and ".join(subj)+")" + body = render_to_string("idrfc/ballot_comment_mail.txt", - dict(discuss=d, comment=c, ad=ad, doc=doc)) + dict(discuss=d, comment=c, ad=ad, doc=doc, pos=pos)) frm = u"%s <%s>" % ad.person.email() to = "The IESG " diff --git a/ietf/idtracker/models.py b/ietf/idtracker/models.py index 1ad4f2f25..b8d524f6e 100644 --- a/ietf/idtracker/models.py +++ b/ietf/idtracker/models.py @@ -710,6 +710,20 @@ class Position(models.Model): return 'X' else: return ' ' + def name(self): + positions = {"yes":"Yes", + "noobj":"No Objection", + "discuss":"Discuss", + "abstain":"Abstain", + "recuse":"Recuse"} + p = None + for k,v in positions.iteritems(): + if self.__dict__[k] > 0: + p = v + if not p: + p = "No Record" + return p + class Meta: db_table = 'ballots' unique_together = (('ballot', 'ad'), ) diff --git a/ietf/templates/idrfc/ballot_comment_mail.txt b/ietf/templates/idrfc/ballot_comment_mail.txt index b4a15841f..7ffbf3eac 100644 --- a/ietf/templates/idrfc/ballot_comment_mail.txt +++ b/ietf/templates/idrfc/ballot_comment_mail.txt @@ -1,5 +1,5 @@ {{ ad }} has entered the following ballot position for -{{ doc.filename }}-{{ doc.revision_display }}. +{{ doc.filename }}-{{ doc.revision_display }}: {{ pos.name }} When responding, please keep the subject line intact and reply to all email addresses included in the To and CC lines. (Feel free to cut this @@ -8,6 +8,9 @@ introductory paragraph, however.) Please refer to http://www.ietf.org/iesg/statement/discuss-criteria.html for more information about IESG DISCUSS and COMMENT positions. +{% if not discuss and not comment %} +There is no DISCUSS or COMMENT text associated with this position. +{% endif %} {% if discuss %}---------------------------------------------------------------------- DISCUSS: