Skip to content

Commit e9d3809

Browse files
committed
Refined the links from document stats pages to author pages so as to not link to non-existent pages. Fixes 404 errors in the test crawler logs.
- Legacy-Id: 17237
1 parent 68174ba commit e9d3809

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright The IETF Trust 2007, All Rights Reserved
1+
# Copyright The IETF Trust 2017-2020, All Rights Reserved
22

33
import datetime
44

@@ -7,10 +7,19 @@
77
import debug # pyflakes:ignore
88

99
from ietf.meeting.utils import is_nomcom_eligible as util_is_nomcom_eligible
10+
from ietf.person.models import Alias
1011

1112
register = template.Library()
1213

1314
@register.filter
1415
def is_nomcom_eligible(person, date=datetime.date.today()):
1516
return util_is_nomcom_eligible(person,date)
1617

18+
@register.filter
19+
def person_by_name(name):
20+
"Look up a person record from name"
21+
if not isinstance(name, (type(b''), type(u''))):
22+
return None
23+
alias = Alias.objects.filter(name=name).first()
24+
return alias.person if alias else None
25+

ietf/templates/stats/includes/number_with_details_cell.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
{% if content_limit and count <= content_limit %}
1+
{% load person_filters %}{% if content_limit and count <= content_limit %}
22
{% for n in names %}
3-
<a href="{% url 'ietf.person.views.profile' email_or_name=n %}">{{ n }}</a><br>
3+
{% with n|person_by_name as person %}
4+
{% if person %}
5+
<a href="{{ person.get_absolute_url }}">{{ n }}</a>
6+
{% else %}
7+
{{ n }}
8+
{% endif %}
9+
<br>
10+
{% endwith %}
411
{% endfor %}
512
{% else %}
613
{# <a class="popover-details" href="" data-elements="{% for n in names|slice:":20" %}{{ n }}{% if not forloop.last %}|{% endif %}{% endfor %}" data-sliced="{% if count > 20 %}1{% endif %}">{{ count }}</a> #}

0 commit comments

Comments
 (0)