@@ -23,11 +23,19 @@ def person_by_name(name):
2323 alias = Alias .objects .filter (name = name ).first ()
2424 return alias .person if alias else None
2525
26+ # CLEANUP: There are several hundred Person objects with no Alias object,
27+ # violating the expectiations of the code. The check for the existance of an
28+ # alias object below matching the person's name avoids presenting a link that
29+ # we know will 404. When the database is corrected and we can expect that the
30+ # Alias for the person's name to always be there, we can remove this extra
31+ # database query (or leave it as a safeguard until it becomes a performance
32+ # issue.)
33+
2634@register .inclusion_tag ('person/person_link.html' )
2735def person_link (person , ** kwargs ):
2836 title = kwargs .get ('title' , '' )
2937 cls = kwargs .get ('class' , '' )
30- name = person .name
38+ name = person .name if person . alias_set . filter ( name = person . name ). exists () else ''
3139 plain_name = person .plain_name ()
3240 email = person .email_address ()
3341 return {'name' : name , 'plain_name' : plain_name , 'email' : email , 'title' : title , 'class' : cls }
@@ -37,7 +45,7 @@ def person_link(person, **kwargs):
3745def email_person_link (email , ** kwargs ):
3846 title = kwargs .get ('title' , '' )
3947 cls = kwargs .get ('class' , '' )
40- name = email .person .name
48+ name = email .person .name if email . person . alias_set . filter ( name = email . person . name ). exists () else ''
4149 plain_name = email .person .plain_name ()
4250 email = email .address
4351 return {'name' : name , 'plain_name' : plain_name , 'email' : email , 'title' : title , 'class' : cls }
0 commit comments