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
This commit is contained in:
Henrik Levkowetz 2010-11-10 09:21:09 +00:00
parent dc833b4492
commit c20d969eaf
3 changed files with 24 additions and 3 deletions

View file

@ -228,11 +228,15 @@ def send_ballot_comment(request, name):
c = comment.text c = comment.text
subj.append("COMMENT") subj.append("COMMENT")
ad_name = str(ad) ad_name = str(ad)
ad_name_genitive = ad_name + "'" if ad_name.endswith('s') else ad_name + "'s" 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", 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() frm = u"%s <%s>" % ad.person.email()
to = "The IESG <iesg@ietf.org>" to = "The IESG <iesg@ietf.org>"

View file

@ -710,6 +710,20 @@ class Position(models.Model):
return 'X' return 'X'
else: else:
return ' ' 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: class Meta:
db_table = 'ballots' db_table = 'ballots'
unique_together = (('ballot', 'ad'), ) unique_together = (('ballot', 'ad'), )

View file

@ -1,5 +1,5 @@
{{ ad }} has entered the following ballot position for {{ 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 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 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 Please refer to http://www.ietf.org/iesg/statement/discuss-criteria.html
for more information about IESG DISCUSS and COMMENT positions. 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 %}---------------------------------------------------------------------- {% if discuss %}----------------------------------------------------------------------
DISCUSS: DISCUSS: