Skip to content

Commit fc88964

Browse files
committed
Go through the code and replace uses of Person.name with Person.plain_name()
- Legacy-Id: 3849
1 parent 36a3e99 commit fc88964

28 files changed

Lines changed: 73 additions & 75 deletions

ietf/idrfc/idrfc_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ def _init(self):
735735

736736
for pos in BallotPositionDocEvent.objects.filter(doc=self.ballot, type="changed_ballot_position", time__gte=self.ballot.process_start, time__lte=self.ballot.process_end).select_related('ad').order_by("-time", '-id'):
737737
if pos.ad not in seen:
738-
p = dict(ad_name=pos.ad.name,
738+
p = dict(ad_name=pos.ad.plain_name(),
739739
ad_username=pos.ad.pk, # ought to rename this in doc_ballot_list
740740
position=pos.pos.name,
741741
is_old_ad=pos.ad not in active_ads,
@@ -775,7 +775,7 @@ def _init(self):
775775
if self.ballot_active:
776776
for ad in active_ads:
777777
if ad not in seen:
778-
d = dict(ad_name=ad.name,
778+
d = dict(ad_name=ad.plain_name(),
779779
ad_username=ad.pk,
780780
position="No Record",
781781
)

ietf/idrfc/lastcall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def request_last_callREDESIGN(request, doc):
3434
e.type = "requested_last_call"
3535
e.by = request.user.get_profile()
3636
e.doc = doc
37-
e.desc = "Last call was requested by %s" % e.by.name
37+
e.desc = "Last call was requested"
3838
e.save()
3939

4040
if settings.USE_DB_REDESIGN_PROXY_CLASSES:

ietf/idrfc/mails.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def email_adREDESIGN(request, doc, ad, changed_by, text, subject=None):
6363
to = ad.role_email("ad").formatted_email()
6464
send_mail(request, to,
6565
"DraftTracker Mail System <iesg-secretary@ietf.org>",
66-
"%s updated by %s" % (doc.file_tag(), changed_by.name),
66+
"%s updated by %s" % (doc.file_tag(), changed_by.plain_name()),
6767
"idrfc/change_notice.txt",
6868
dict(text=html_to_text(text),
6969
doc=doc,
@@ -325,9 +325,9 @@ def generate_approval_mail_approved(request, doc):
325325
other_director = Person.objects.filter(role__group__role__person=director, role__group__role__name="ad").exclude(pk=director.pk)
326326

327327
if doc.group.type_id != "individ" and other_director:
328-
contacts = "The IESG contact persons are %s and %s." % (director.name, other_director[0].name)
328+
contacts = "The IESG contact persons are %s and %s." % (director.plain_name(), other_director[0].plain_name())
329329
else:
330-
contacts = "The IESG contact person is %s." % director.name
330+
contacts = "The IESG contact person is %s." % director.plain_name()
331331

332332
doc_type = "RFC" if doc.get_state_slug() == "rfc" else "Internet Draft"
333333

@@ -559,7 +559,7 @@ def formatted(val):
559559
return "[ ]"
560560

561561
fmt = u"%-21s%-10s%-11s%-9s%-10s" % (
562-
p.ad.name[:21],
562+
p.ad.plain_name()[:21],
563563
formatted(p.pos_id == "yes"),
564564
formatted(p.pos_id == "noobj"),
565565
formatted(p.pos_id == "discuss"),
@@ -577,7 +577,7 @@ def formatted(val):
577577

578578
active_ad_positions.sort()
579579
inactive_ad_positions.sort()
580-
ad_feedback.sort(key=lambda p: p.ad.name)
580+
ad_feedback.sort(key=lambda p: p.ad.plain_name())
581581

582582
e = doc.latest_event(LastCallDocEvent, type="sent_last_call")
583583
last_call_expires = e.expires if e else None

ietf/idrfc/templatetags/ballot_icon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get_user_name(context):
5252
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
5353
from person.models import Person
5454
try:
55-
return context['user'].get_profile().name
55+
return context['user'].get_profile().plain_name()
5656
except Person.DoesNotExist:
5757
return None
5858

ietf/idrfc/utils.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,20 +164,19 @@ def update_telechatREDESIGN(request, doc, by, new_telechat_date, new_returning_i
164164

165165
if on_agenda != prev_agenda:
166166
if on_agenda:
167-
e.desc = "Placed on agenda for telechat - %s by %s" % (
168-
new_telechat_date, by.name)
167+
e.desc = "Placed on agenda for telechat - %s" % (new_telechat_date)
169168
else:
170-
e.desc = "Removed from agenda for telechat by %s" % by.name
169+
e.desc = "Removed from agenda for telechat"
171170
elif on_agenda and new_telechat_date != prev_telechat:
172-
e.desc = "Telechat date has been changed to <b>%s</b> from <b>%s</b> by %s" % (
173-
new_telechat_date, prev_telechat, by.name)
171+
e.desc = "Telechat date has been changed to <b>%s</b> from <b>%s</b>" % (
172+
new_telechat_date, prev_telechat)
174173
else:
175174
# we didn't reschedule but flipped returning item bit - let's
176175
# just explain that
177176
if returning:
178-
e.desc = "Added as returning item on telechat by %s" % by.name
177+
e.desc = "Added as returning item on telechat"
179178
else:
180-
e.desc = "Removed as returning item on telechat by %s" % by.name
179+
e.desc = "Removed as returning item on telechat"
181180

182181
e.save()
183182

ietf/idrfc/views_ballot.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,17 +296,17 @@ def edit_positionREDESIGN(request, name):
296296

297297
# figure out a description
298298
if not old_pos and pos.pos.slug != "norecord":
299-
pos.desc = u"[Ballot Position Update] New position, %s, has been recorded for %s" % (pos.pos.name, pos.ad.name)
299+
pos.desc = u"[Ballot Position Update] New position, %s, has been recorded for %s" % (pos.pos.name, pos.ad.plain_name())
300300
elif old_pos and pos.pos != old_pos.pos:
301-
pos.desc = "[Ballot Position Update] Position for %s has been changed to %s from %s" % (pos.ad.name, pos.pos.name, old_pos.pos.name)
301+
pos.desc = "[Ballot Position Update] Position for %s has been changed to %s from %s" % (pos.ad.plain_name(), pos.pos.name, old_pos.pos.name)
302302

303303
if not pos.desc and changes:
304-
pos.desc = u"Ballot %s text updated for %s" % (u" and ".join(changes), ad.name)
304+
pos.desc = u"Ballot %s text updated for %s" % (u" and ".join(changes), ad.plain_name())
305305

306306
# only add new event if we actually got a change
307307
if pos.desc:
308308
if login != ad:
309-
pos.desc += u" by %s" % login.name
309+
pos.desc += u" by %s" % login.plain_name()
310310

311311
pos.save()
312312

@@ -468,15 +468,15 @@ def send_ballot_commentREDESIGN(request, name):
468468
c = pos.comment
469469
subj.append("COMMENT")
470470

471-
ad_name_genitive = ad.name + "'" if ad.name.endswith('s') else ad.name + "'s"
471+
ad_name_genitive = ad.plain_name() + "'" if ad.plain_name().endswith('s') else ad.plain_name() + "'s"
472472
subject = "%s %s on %s" % (ad_name_genitive, pos.pos.name if pos.pos else "No Position", doc.name + "-" + doc.rev)
473473
if subj:
474474
subject += ": (with %s)" % " and ".join(subj)
475475

476476
doc.filename = doc.name # compatibility attributes
477477
doc.revision_display = doc.rev
478478
body = render_to_string("idrfc/ballot_comment_mail.txt",
479-
dict(discuss=d, comment=c, ad=ad.name, doc=doc, pos=pos.pos))
479+
dict(discuss=d, comment=c, ad=ad.plain_name(), doc=doc, pos=pos.pos))
480480
frm = ad.role_email("ad").formatted_email()
481481
to = "The IESG <iesg@ietf.org>"
482482

@@ -568,7 +568,7 @@ def defer_ballotREDESIGN(request, name):
568568
email_state_changed(request, doc, e.desc)
569569

570570
update_telechat(request, doc, login, telechat_date)
571-
email_ballot_deferred(request, doc, login.name, telechat_date)
571+
email_ballot_deferred(request, doc, login.plain_name(), telechat_date)
572572

573573
return HttpResponseRedirect(doc.get_absolute_url())
574574

@@ -957,7 +957,7 @@ def ballot_writeupnotesREDESIGN(request, name):
957957
pos.type = "changed_ballot_position"
958958
pos.ad = login
959959
pos.pos_id = "yes"
960-
pos.desc = "[Ballot Position Update] New position, %s, has been recorded for %s" % (pos.pos.name, pos.ad.name)
960+
pos.desc = "[Ballot Position Update] New position, %s, has been recorded for %s" % (pos.pos.name, pos.ad.plain_name())
961961
pos.save()
962962

963963
approval = doc.latest_event(WriteupDocEvent, type="changed_ballot_approval_text")
@@ -972,7 +972,7 @@ def ballot_writeupnotesREDESIGN(request, name):
972972
e = DocEvent(doc=doc, by=login)
973973
e.by = login
974974
e.type = "sent_ballot_announcement"
975-
e.desc = "Ballot has been issued by %s" % login.name
975+
e.desc = "Ballot has been issued"
976976
e.save()
977977

978978
return render_to_response('idrfc/ballot_issued.html',
@@ -1358,7 +1358,7 @@ def make_last_callREDESIGN(request, name):
13581358

13591359
e = LastCallDocEvent(doc=doc, by=login)
13601360
e.type = "sent_last_call"
1361-
e.desc = "Last call sent by %s" % login.name
1361+
e.desc = "Last call sent"
13621362
if form.cleaned_data['last_call_sent_date'] != e.time.date():
13631363
e.time = datetime.datetime.combine(form.cleaned_data['last_call_sent_date'], e.time.time())
13641364
e.expires = form.cleaned_data['last_call_expiration_date']

ietf/idrfc/views_doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def _get_history(doc, versions):
168168
info["dontmolest"] = True
169169

170170
info['text'] = e.desc
171-
info['by'] = e.by.name
171+
info['by'] = e.by.plain_name()
172172
info['textSnippet'] = truncatewords_html(format_textarea(fill(info['text'], 80)), 25)
173173
info['snipped'] = info['textSnippet'][-3:] == "..." and e.type != "new_revision"
174174
results.append({'comment':e, 'info':info, 'date':e.time, 'is_com':True})

ietf/idrfc/views_edit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def __init__(self, *args, **kwargs):
453453
ad_pk = self.initial.get('ad')
454454
choices = self.fields['ad'].choices
455455
if ad_pk and ad_pk not in [pk for pk, name in choices]:
456-
self.fields['ad'].choices = list(choices) + [("", "-------"), (ad_pk, Person.objects.get(pk=ad_pk).name)]
456+
self.fields['ad'].choices = list(choices) + [("", "-------"), (ad_pk, Person.objects.get(pk=ad_pk).plain_name())]
457457

458458
# telechat choices
459459
dates = [d.date for d in TelechatDate.objects.active().order_by('date')]

ietf/idrfc/views_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def __init__(self, *args, **kwargs):
307307
active_ads.sort(key=extract_last_name)
308308
inactive_ads.sort(key=extract_last_name)
309309

310-
self.fields['ad'].choices = c = [('', 'any AD')] + [(ad.pk, ad.name) for ad in active_ads] + [('', '------------------')] + [(ad.pk, ad.name) for ad in inactive_ads]
310+
self.fields['ad'].choices = c = [('', 'any AD')] + [(ad.pk, ad.plain_name()) for ad in active_ads] + [('', '------------------')] + [(ad.pk, ad.name) for ad in inactive_ads]
311311
self.fields['subState'].choices = [('', 'any substate'), ('0', 'no substate')] + [(n.slug, n.name) for n in DocTagName.objects.filter(slug__in=('point', 'ad-f-up', 'need-rev', 'extpty'))]
312312
def clean_name(self):
313313
value = self.cleaned_data.get('name','')
@@ -574,7 +574,7 @@ def by_ad(request, name):
574574
| Q(pk__in=responsible)):
575575
if name == p.full_name_as_key():
576576
ad_id = p.id
577-
ad_name = p.name
577+
ad_name = p.plain_name()
578578
break
579579
else:
580580
for i in IESGLogin.objects.filter(user_level__in=[1,2]):

ietf/ietfworkflows/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def get_notification_receivers(doc, extra_notify):
244244
persons = set()
245245
res = []
246246
for r in Role.objects.filter(group=doc.group, name__in=("chair", "delegate")):
247-
res.append(u'"%s" <%s>' % (r.person.name, r.email.address))
247+
res.append(u'"%s" <%s>' % (r.person.plain_name(), r.email.address))
248248
persons.add(r.person)
249249

250250
for email in doc.authors.all():

0 commit comments

Comments
 (0)