Go through the code and replace uses of Person.name with Person.plain_name()

- Legacy-Id: 3849
This commit is contained in:
Ole Laursen 2012-01-23 20:22:45 +00:00
parent 36a3e99417
commit fc88964298
28 changed files with 73 additions and 75 deletions

View file

@ -735,7 +735,7 @@ class BallotWrapper:
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'):
if pos.ad not in seen:
p = dict(ad_name=pos.ad.name,
p = dict(ad_name=pos.ad.plain_name(),
ad_username=pos.ad.pk, # ought to rename this in doc_ballot_list
position=pos.pos.name,
is_old_ad=pos.ad not in active_ads,
@ -775,7 +775,7 @@ class BallotWrapper:
if self.ballot_active:
for ad in active_ads:
if ad not in seen:
d = dict(ad_name=ad.name,
d = dict(ad_name=ad.plain_name(),
ad_username=ad.pk,
position="No Record",
)

View file

@ -34,7 +34,7 @@ def request_last_callREDESIGN(request, doc):
e.type = "requested_last_call"
e.by = request.user.get_profile()
e.doc = doc
e.desc = "Last call was requested by %s" % e.by.name
e.desc = "Last call was requested"
e.save()
if settings.USE_DB_REDESIGN_PROXY_CLASSES:

View file

@ -63,7 +63,7 @@ def email_adREDESIGN(request, doc, ad, changed_by, text, subject=None):
to = ad.role_email("ad").formatted_email()
send_mail(request, to,
"DraftTracker Mail System <iesg-secretary@ietf.org>",
"%s updated by %s" % (doc.file_tag(), changed_by.name),
"%s updated by %s" % (doc.file_tag(), changed_by.plain_name()),
"idrfc/change_notice.txt",
dict(text=html_to_text(text),
doc=doc,
@ -325,9 +325,9 @@ def generate_approval_mail_approved(request, doc):
other_director = Person.objects.filter(role__group__role__person=director, role__group__role__name="ad").exclude(pk=director.pk)
if doc.group.type_id != "individ" and other_director:
contacts = "The IESG contact persons are %s and %s." % (director.name, other_director[0].name)
contacts = "The IESG contact persons are %s and %s." % (director.plain_name(), other_director[0].plain_name())
else:
contacts = "The IESG contact person is %s." % director.name
contacts = "The IESG contact person is %s." % director.plain_name()
doc_type = "RFC" if doc.get_state_slug() == "rfc" else "Internet Draft"
@ -559,7 +559,7 @@ def generate_issue_ballot_mailREDESIGN(request, doc):
return "[ ]"
fmt = u"%-21s%-10s%-11s%-9s%-10s" % (
p.ad.name[:21],
p.ad.plain_name()[:21],
formatted(p.pos_id == "yes"),
formatted(p.pos_id == "noobj"),
formatted(p.pos_id == "discuss"),
@ -577,7 +577,7 @@ def generate_issue_ballot_mailREDESIGN(request, doc):
active_ad_positions.sort()
inactive_ad_positions.sort()
ad_feedback.sort(key=lambda p: p.ad.name)
ad_feedback.sort(key=lambda p: p.ad.plain_name())
e = doc.latest_event(LastCallDocEvent, type="sent_last_call")
last_call_expires = e.expires if e else None

View file

@ -52,7 +52,7 @@ def get_user_name(context):
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
from person.models import Person
try:
return context['user'].get_profile().name
return context['user'].get_profile().plain_name()
except Person.DoesNotExist:
return None

View file

@ -164,20 +164,19 @@ def update_telechatREDESIGN(request, doc, by, new_telechat_date, new_returning_i
if on_agenda != prev_agenda:
if on_agenda:
e.desc = "Placed on agenda for telechat - %s by %s" % (
new_telechat_date, by.name)
e.desc = "Placed on agenda for telechat - %s" % (new_telechat_date)
else:
e.desc = "Removed from agenda for telechat by %s" % by.name
e.desc = "Removed from agenda for telechat"
elif on_agenda and new_telechat_date != prev_telechat:
e.desc = "Telechat date has been changed to <b>%s</b> from <b>%s</b> by %s" % (
new_telechat_date, prev_telechat, by.name)
e.desc = "Telechat date has been changed to <b>%s</b> from <b>%s</b>" % (
new_telechat_date, prev_telechat)
else:
# we didn't reschedule but flipped returning item bit - let's
# just explain that
if returning:
e.desc = "Added as returning item on telechat by %s" % by.name
e.desc = "Added as returning item on telechat"
else:
e.desc = "Removed as returning item on telechat by %s" % by.name
e.desc = "Removed as returning item on telechat"
e.save()

View file

@ -296,17 +296,17 @@ def edit_positionREDESIGN(request, name):
# figure out a description
if not old_pos and pos.pos.slug != "norecord":
pos.desc = u"[Ballot Position Update] New position, %s, has been recorded for %s" % (pos.pos.name, pos.ad.name)
pos.desc = u"[Ballot Position Update] New position, %s, has been recorded for %s" % (pos.pos.name, pos.ad.plain_name())
elif old_pos and pos.pos != old_pos.pos:
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)
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)
if not pos.desc and changes:
pos.desc = u"Ballot %s text updated for %s" % (u" and ".join(changes), ad.name)
pos.desc = u"Ballot %s text updated for %s" % (u" and ".join(changes), ad.plain_name())
# only add new event if we actually got a change
if pos.desc:
if login != ad:
pos.desc += u" by %s" % login.name
pos.desc += u" by %s" % login.plain_name()
pos.save()
@ -468,7 +468,7 @@ def send_ballot_commentREDESIGN(request, name):
c = pos.comment
subj.append("COMMENT")
ad_name_genitive = ad.name + "'" if ad.name.endswith('s') else ad.name + "'s"
ad_name_genitive = ad.plain_name() + "'" if ad.plain_name().endswith('s') else ad.plain_name() + "'s"
subject = "%s %s on %s" % (ad_name_genitive, pos.pos.name if pos.pos else "No Position", doc.name + "-" + doc.rev)
if subj:
subject += ": (with %s)" % " and ".join(subj)
@ -476,7 +476,7 @@ def send_ballot_commentREDESIGN(request, name):
doc.filename = doc.name # compatibility attributes
doc.revision_display = doc.rev
body = render_to_string("idrfc/ballot_comment_mail.txt",
dict(discuss=d, comment=c, ad=ad.name, doc=doc, pos=pos.pos))
dict(discuss=d, comment=c, ad=ad.plain_name(), doc=doc, pos=pos.pos))
frm = ad.role_email("ad").formatted_email()
to = "The IESG <iesg@ietf.org>"
@ -568,7 +568,7 @@ def defer_ballotREDESIGN(request, name):
email_state_changed(request, doc, e.desc)
update_telechat(request, doc, login, telechat_date)
email_ballot_deferred(request, doc, login.name, telechat_date)
email_ballot_deferred(request, doc, login.plain_name(), telechat_date)
return HttpResponseRedirect(doc.get_absolute_url())
@ -957,7 +957,7 @@ def ballot_writeupnotesREDESIGN(request, name):
pos.type = "changed_ballot_position"
pos.ad = login
pos.pos_id = "yes"
pos.desc = "[Ballot Position Update] New position, %s, has been recorded for %s" % (pos.pos.name, pos.ad.name)
pos.desc = "[Ballot Position Update] New position, %s, has been recorded for %s" % (pos.pos.name, pos.ad.plain_name())
pos.save()
approval = doc.latest_event(WriteupDocEvent, type="changed_ballot_approval_text")
@ -972,7 +972,7 @@ def ballot_writeupnotesREDESIGN(request, name):
e = DocEvent(doc=doc, by=login)
e.by = login
e.type = "sent_ballot_announcement"
e.desc = "Ballot has been issued by %s" % login.name
e.desc = "Ballot has been issued"
e.save()
return render_to_response('idrfc/ballot_issued.html',
@ -1358,7 +1358,7 @@ def make_last_callREDESIGN(request, name):
e = LastCallDocEvent(doc=doc, by=login)
e.type = "sent_last_call"
e.desc = "Last call sent by %s" % login.name
e.desc = "Last call sent"
if form.cleaned_data['last_call_sent_date'] != e.time.date():
e.time = datetime.datetime.combine(form.cleaned_data['last_call_sent_date'], e.time.time())
e.expires = form.cleaned_data['last_call_expiration_date']

View file

@ -168,7 +168,7 @@ def _get_history(doc, versions):
info["dontmolest"] = True
info['text'] = e.desc
info['by'] = e.by.name
info['by'] = e.by.plain_name()
info['textSnippet'] = truncatewords_html(format_textarea(fill(info['text'], 80)), 25)
info['snipped'] = info['textSnippet'][-3:] == "..." and e.type != "new_revision"
results.append({'comment':e, 'info':info, 'date':e.time, 'is_com':True})

View file

@ -453,7 +453,7 @@ class EditInfoFormREDESIGN(forms.Form):
ad_pk = self.initial.get('ad')
choices = self.fields['ad'].choices
if ad_pk and ad_pk not in [pk for pk, name in choices]:
self.fields['ad'].choices = list(choices) + [("", "-------"), (ad_pk, Person.objects.get(pk=ad_pk).name)]
self.fields['ad'].choices = list(choices) + [("", "-------"), (ad_pk, Person.objects.get(pk=ad_pk).plain_name())]
# telechat choices
dates = [d.date for d in TelechatDate.objects.active().order_by('date')]

View file

@ -307,7 +307,7 @@ if settings.USE_DB_REDESIGN_PROXY_CLASSES:
active_ads.sort(key=extract_last_name)
inactive_ads.sort(key=extract_last_name)
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]
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]
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'))]
def clean_name(self):
value = self.cleaned_data.get('name','')
@ -574,7 +574,7 @@ def by_ad(request, name):
| Q(pk__in=responsible)):
if name == p.full_name_as_key():
ad_id = p.id
ad_name = p.name
ad_name = p.plain_name()
break
else:
for i in IESGLogin.objects.filter(user_level__in=[1,2]):

View file

@ -244,7 +244,7 @@ def get_notification_receivers(doc, extra_notify):
persons = set()
res = []
for r in Role.objects.filter(group=doc.group, name__in=("chair", "delegate")):
res.append(u'"%s" <%s>' % (r.person.name, r.email.address))
res.append(u'"%s" <%s>' % (r.person.plain_name(), r.email.address))
persons.add(r.person)
for email in doc.authors.all():

View file

@ -35,7 +35,7 @@ def get_person_for_user(user):
return None
try:
p = user.get_profile()
p.email = lambda: (p.name, p.email_address())
p.email = lambda: (p.plain_name(), p.email_address())
return p
except Person.DoesNotExist:
return None

View file

@ -73,7 +73,7 @@ def send_sdo_reminder(sdo):
subject = 'Request for update of list of authorized individuals'
to_email = manager_role.email.address
name = manager_role.person.name
name = manager_role.person.plain_name()
authorized_list = role_persons_with_fixed_email(sdo, "auth")
body = render_to_string('liaisons/sdo_reminder.txt', dict(

View file

@ -5,14 +5,14 @@
<h1>IAB/IESG Nominating Committee</h1>
<h3>Current Committee Chair: <a href="mailto:{{ curr_chair.email.address }}">{{ curr_chair.person.name }}</a></h3>
<h3>Current Committee Chair: <a href="mailto:{{ curr_chair.email.address }}">{{ curr_chair.person.plain_name }}</a></h3>
{% for regime in regimes %}
<hr>
<h1>Messages from {{ regime.group.start_year }} - {{ regime.group.end_year }}</h1>
{# use person email address here rather than the generic nomcom-chair@ietf.org #}
<h4>Committee Chair: <a href="mailto:{{ regime.chair.person.email_address }}">{{ regime.chair.person.name }}</a></h4>
<h4>Committee Chair: <a href="mailto:{{ regime.chair.person.email_address }}">{{ regime.chair.person.plain_name }}</a></h4>
<table class="ietf-table">
<tr>
<th width="10%">Date</th>

View file

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}Change position for {{ ad.name }} on {{ doc }}{% endblock %}
{% block title %}Change position for {{ ad.plain_name }} on {{ doc }}{% endblock %}
{% block morecss %}
div.ballot-deferred {
@ -33,7 +33,7 @@ form.position-form .comment-text {
{% endblock %}
{% block content %}
<h1>Change position for {{ ad.name }} {{ doc }}</h1>
<h1>Change position for {{ ad.plain_name }} {{ doc }}</h1>
{% if ballot_deferred %}
<div class="ballot-deferred">Ballot deferred by {{ ballot_deferred.by }} on {{ ballot_deferred.time|date:"Y-m-d" }}.</div>

View file

@ -49,9 +49,9 @@ Some parts Copyright (c) 2009 The IETF Trust, all rights reserved.
{% endfor %} {% if doc.obj.ballot.active %}<br><b>Discusses/comments</b> (from <a href="http://datatracker.ietf.org/idtracker/ballot/{{ doc.obj.ballot.ballot}}/">ballot {{doc.obj.ballot.ballot }})</a>:
<ol>
{% if USE_DB_REDESIGN_PROXY_CLASSES %}
{% for p in doc.obj.active_positions|dictsort:"ad.name" %}{% if p.pos %}{% ifequal p.pos.pos_id "discuss" %}<li><a href="#{{doc.obj.document.filename}}+{{p.pos.ad|slugify}}+discuss">{{ p.pos.ad.name }}: Discuss [{{ p.pos.discuss_time.date }}]</a>:
{% for p in doc.obj.active_positions|dictsort:"ad.plain_name" %}{% if p.pos %}{% ifequal p.pos.pos_id "discuss" %}<li><a href="#{{doc.obj.document.filename}}+{{p.pos.ad|slugify}}+discuss">{{ p.pos.ad.plain_name }}: Discuss [{{ p.pos.discuss_time.date }}]</a>:
<br>...
{% endifequal %}{% if p.pos.comment %} <li><a href="#{{doc.obj.document.filename}}+{{position.ad|slugify}}+comment">{{ p.pos.ad.name }}: Comment [{{ p.pos.comment_time.date }}]</a>:
{% endifequal %}{% if p.pos.comment %} <li><a href="#{{doc.obj.document.filename}}+{{position.ad|slugify}}+comment">{{ p.pos.ad.plain_name }}: Comment [{{ p.pos.comment_time.date }}]</a>:
<br>...
{% endif %}{% endif %}{% endfor %}
{% else %}

View file

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block title %}Change position for {{ ad.name }} on {{ wg.acronym }}{% endblock %}
{% block title %}Change position for {{ ad.plain_name }} on {{ wg.acronym }}{% endblock %}
{% block morecss %}
form.position-form .position ul {
@ -29,7 +29,7 @@ form.position-form .comment {
{% endblock %}
{% block content %}
<h1>Change position for {{ ad.name }} on {{ wg.acronym }}</h1>
<h1>Change position for {{ ad.plain_name }} on {{ wg.acronym }}</h1>
<form class="position-form" action="" method="POST">
<div>

View file

@ -3,16 +3,16 @@
Current Status: {{ wg.state.name }} Working Group
Chairs:
{% for p in info.chairs %} {{ p.name }} <{{p.email}}>
{% for p in info.chairs %} {{ p.plain_name }} <{{p.email}}>
{% endfor %}
Secretaries:
{% for p in info.secr %} {{ p.name }} <{{p.email}}>
{% for p in info.secr %} {{ p.plain_name }} <{{p.email}}>
{% endfor %}
Technical advisors:
{% for p in info.techadv %} {{ p.name }} <{{p.email}}>
{% for p in info.techadv %} {{ p.plain_name }} <{{p.email}}>
{% endfor %}
Assigned Area Director:
{{ info.ad.0.name }} <{{ info.ad.0.email }}>
{{ info.ad.0.plain_name }} <{{ info.ad.0.email }}>
Mailing list:
Address: {{ info.list.0 }}

View file

@ -13,7 +13,7 @@
{% for e in events %}
<tr class="{% cycle oddrow,evenrow %}">
<td>{{ e.time|date:"Y-m-d"}}</td>
<td>{{ e.by.name }}</td>
<td>{{ e.by.plain_name }}</td>
<td>{{ e.desc|format_history_text }}</td>
</tr>
{% endfor %}

View file

@ -16,13 +16,13 @@
{{ wg.areadirector.person.name|safe }} <{{wg.areadirector.address}}>
{% if wg.techadvisors %}
Tech Advisor{{ wg.techadvisors|pluralize }}:
{% for techadvisor in wg.techadvisors %} {{ techadvisor.person.name|safe }} <{{techadvisor.address}}>
{% for techadvisor in wg.techadvisors %} {{ techadvisor.person.plain_name|safe }} <{{techadvisor.address}}>
{% endfor %}{% endif %}{% if wg.editors %}
Editor{{ wg.editors|pluralize }}:
{% for editor in wg.editors %} {{ editor.person.name|safe }} <{{editor.person.address}}>
{% for editor in wg.editors %} {{ editor.person.plain_name|safe }} <{{editor.person.address}}>
{% endfor %}{% endif %}{% if wg.secretaries %}
Secretar{{ wg.secretaries|pluralize:"y,ies" }}:
{% for secretary in wg.secretaries %} {{ secretary.person.name|safe }} <{{secretary.person.address}}>
{% for secretary in wg.secretaries %} {{ secretary.person.plain_name|safe }} <{{secretary.person.address}}>
{% endfor %}{% endif %}
Mailing Lists:
General Discussion: {{ wg.email_address }}

View file

@ -58,7 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<p>Area Director{{ forloop.revcounter|pluralize }}:</p>
<table style="margin-left: 2em" class="ietf-wg-table">
{% endif %}
<tr><td><span class="square bgcolor{{forloop.counter}}">&nbsp;</span></td> <td><a href="mailto:{{ ad.address }}">{{ ad.person.name }} &lt;{{ ad.address }}&gt;</a></td></tr>
<tr><td><span class="square bgcolor{{forloop.counter}}">&nbsp;</span></td> <td><a href="mailto:{{ ad.address }}">{{ ad.person.plain_name }} &lt;{{ ad.address }}&gt;</a></td></tr>
{% if forloop.last %}
</table>
{% endif %}
@ -85,7 +85,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<td width="10%;"><a href="/wg/{{ wg.acronym }}/">{{ wg.acronym }}</a></td>
<td width="1%">{% for ad in area.ads %}{% ifequal ad.person_id wg.ad_id %}<span title="AD for {{ wg.acronym }}: {{ad.person }}" class="square bgcolor{{forloop.counter}}"></span>{% endifequal %}{% endfor %}</td>
<td width="50%">{{ wg.name }}</td>
<td width="39%">{% for chair in wg.chairs %}<a href="mailto:{{ chair.address }}">{{ chair.person.name }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</td>
<td width="39%">{% for chair in wg.chairs %}<a href="mailto:{{ chair.address }}">{{ chair.person.plain_name }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</td>
</tr>
{% if forloop.last %}
</table>

View file

@ -210,7 +210,7 @@ def assign_shepherd(user, internetdraft, shepherd):
if not shepherd:
e.desc = u"Unassigned shepherd"
else:
e.desc = u"Changed shepherd to %s" % shepherd.name
e.desc = u"Changed shepherd to %s" % shepherd.plain_name()
e.save()
# update proxy too

View file

@ -94,7 +94,7 @@ class ManageDelegatesTestCase(django.test.TestCase):
self.assertEquals(r.status_code, 200)
q = PyQuery(r.content)
self.assertTrue("new delegate" in r.content)
self.assertTrue(Email.objects.get(address="plain@example.com").person.name in r.content)
self.assertTrue(Email.objects.get(address="plain@example.com").person.plain_name() in r.content)
self.assertEquals(Role.objects.filter(name="delegate", group__acronym="mars", email__address="plain@example.com").count(), 1)
self.assertEquals(history_before + 1, GroupHistory.objects.filter(acronym="mars").count())
@ -162,7 +162,7 @@ class ManageShepherdsTestCase(django.test.TestCase):
# get
r = self.client.get(url)
self.assertEquals(r.status_code, 200)
self.assertTrue(Person.objects.get(user__username="secretary").name in r.content)
self.assertTrue(Person.objects.get(user__username="secretary").plain_name() in r.content)
q = PyQuery(r.content)
self.assertEquals(len(q('input[type=submit][name=remove_shepherd]')), 1)
@ -183,7 +183,7 @@ class ManageShepherdsTestCase(django.test.TestCase):
self.assertEquals(r.status_code, 200)
q = PyQuery(r.content)
self.assertTrue("Shepherd assigned" in r.content)
self.assertTrue(Email.objects.get(address="plain@example.com").person.name in r.content)
self.assertTrue(Email.objects.get(address="plain@example.com").person.plain_name() in r.content)
self.assertEquals(draft.docevent_set.count(), events_before + 1)
class ManageWorkflowTestCase(django.test.TestCase):

View file

@ -38,13 +38,13 @@ class GroupComments(Feed):
for h in history:
gh = find_history_active_at(obj, h['date'])
if gh:
h['chairs'] = [x.email.person.name for x in gh.rolehistory_set.filter(name__slug="chair")]
h['secr'] = [x.email.person.name for x in gh.rolehistory_set.filter(name__slug="secr")]
h['techadv'] = [x.email.person.name for x in gh.rolehistory_set.filter(name__slug="techadv")]
h['chairs'] = [x.person.plain_name() for x in gh.rolehistory_set.filter(name__slug="chair")]
h['secr'] = [x.person.plain_name() for x in gh.rolehistory_set.filter(name__slug="secr")]
h['techadv'] = [x.person.plain_name() for x in gh.rolehistory_set.filter(name__slug="techadv")]
else:
h['chairs'] = [x.email.person.name for x in obj.role_set.filter(name__slug="chair")]
h['secr'] = [x.email.person.name for x in obj.role_set.filter(name__slug="secr")]
h['techadv'] = [x.email.person.name for x in obj.role_set.filter(name__slug="techadv")]
h['chairs'] = [x.person.plain_name() for x in obj.role_set.filter(name__slug="chair")]
h['secr'] = [x.person.plain_name() for x in obj.role_set.filter(name__slug="secr")]
h['techadv'] = [x.person.plain_name() for x in obj.role_set.filter(name__slug="techadv")]
dh = find_history_active_at(obj.charter, h['date'])
if dh:
h['rev'] = dh.rev

View file

@ -75,7 +75,7 @@ def generate_issue_ballot_mail(request, charter):
return "[ ]"
fmt = u"%-21s%-6s%-6s%-8s%-7s" % (
p.ad.name,
p.ad.plain_name(),
formatted(p.pos_id == "yes"),
formatted(p.pos_id == "no"),
formatted(p.pos_id == "block"),
@ -93,7 +93,7 @@ def generate_issue_ballot_mail(request, charter):
active_ad_positions.sort()
inactive_ad_positions.sort()
ad_feedback.sort(key=lambda p: p.ad.name)
ad_feedback.sort(key=lambda p: p.ad.plain_name())
e = charter.latest_event(WriteupDocEvent, type="changed_action_announcement")
approval_text = e.text if e else ""

View file

@ -20,7 +20,7 @@ def get_user_name(context):
if 'user' in context and context['user'].is_authenticated():
from person.models import Person
try:
return context['user'].get_profile().name
return context['user'].get_profile().plain_name()
except Person.DoesNotExist:
return None

View file

@ -198,11 +198,10 @@ def update_telechat(request, doc, by, new_telechat_date):
if on_agenda != prev_agenda:
if on_agenda:
e.desc = "Placed on agenda for telechat - %s by %s" % (
new_telechat_date, by.name)
e.desc = "Placed on agenda for telechat - %s" % new_telechat_date
else:
e.desc = "Removed from agenda for telechat by %s" % by.name
e.desc = "Removed from agenda for telechat"
e.save()
elif on_agenda and new_telechat_date != prev_telechat:
e.desc = "Telechat date has been changed to <b>%s</b> from <b>%s</b> by %s" % (new_telechat_date, prev_telechat, by.name)
e.desc = "Telechat date has been changed to <b>%s</b> from <b>%s</b>" % (new_telechat_date, prev_telechat)
e.save()

View file

@ -120,7 +120,7 @@ def change_state(request, name, option=None):
if change and charter:
messages = {}
messages['extrev'] = "The WG has been set to External review by %s. Please schedule discussion for the next IESG telechat." % login.name
messages['extrev'] = "The WG has been set to External review by %s. Please schedule discussion for the next IESG telechat." % login.plain_name()
if message:
email_secretariat(request, wg, "state-%s" % charter_state.slug, message)
@ -148,13 +148,13 @@ def change_state(request, name, option=None):
else:
if option == "recharter":
hide = ['charter_state']
init = dict(initial_time=1, message="%s has initiated a recharter effort on the WG %s (%s)" % (login.name, wg.name, wg.acronym))
init = dict(initial_time=1, message="%s has initiated a recharter effort on the WG %s (%s)" % (login.plain_name(), wg.name, wg.acronym))
elif option == "initcharter":
hide = ['charter_state']
init = dict(initial_time=1, message="%s has initiated chartering of the proposed WG %s (%s)" % (login.name, wg.name, wg.acronym))
init = dict(initial_time=1, message="%s has initiated chartering of the proposed WG %s (%s)" % (login.plain_name(), wg.name, wg.acronym))
elif option == "abandon":
hide = ['initial_time', 'charter_state']
init = dict(message="%s has abandoned the chartering effort on the WG %s (%s)" % (login.name, wg.name, wg.acronym))
init = dict(message="%s has abandoned the chartering effort on the WG %s (%s)" % (login.plain_name(), wg.name, wg.acronym))
else:
hide = ['initial_time']
init = dict(charter_state=wg.charter.get_state_slug(), state=wg.state_id)
@ -218,7 +218,7 @@ class EditInfoForm(forms.Form):
ad_pk = self.initial.get('ad')
choices = self.fields['ad'].choices
if ad_pk and ad_pk not in [pk for pk, name in choices]:
self.fields['ad'].choices = list(choices) + [("", "-------"), (ad_pk, Person.objects.get(pk=ad_pk).name)]
self.fields['ad'].choices = list(choices) + [("", "-------"), (ad_pk, Person.objects.get(pk=ad_pk).plain_name())]
# telechat choices
dates = [d.date for d in TelechatDate.objects.active().order_by('date')]
if 'telechat_date' in kwargs['initial']:

View file

@ -44,7 +44,7 @@ class SearchForm(forms.Form):
active_ads.sort(key=extract_last_name)
inactive_ads.sort(key=extract_last_name)
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]
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]
def clean_nameacronym(self):
value = self.cleaned_data.get('nameacronym','')
@ -287,7 +287,7 @@ def in_process(request):
def json_emails(l):
result = []
for p in l:
result.append({"id": p.address + "", "name": p.person.name + " &lt;" + p.address + "&gt;"})
result.append({"id": p.address + "", "name": p.person.plain_name() + " &lt;" + p.address + "&gt;"})
return simplejson.dumps(result)
def search_person(request):