File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,10 +37,19 @@ def person_by_name(name):
3737
3838@register .inclusion_tag ("person/person_link.html" )
3939def person_link (person , ** kwargs ):
40+ """Render a link to a Person
41+
42+ If person is None or a string, renders as a span containing '(None)'.
43+ """
44+ if isinstance (person , str ):
45+ # If person is a string, most likely an invalid template variable was referenced.
46+ # That normally comes in as an empty string, but may be non-empty if string_if_invalid
47+ # is set. Translate strings into None to try to get consistent behavior.
48+ person = None
4049 title = kwargs .get ("title" , "" )
4150 cls = kwargs .get ("class" , "" )
4251 with_email = kwargs .get ("with_email" , True )
43- if person :
52+ if person is not None :
4453 plain_name = person .plain_name ()
4554 name = (
4655 person .name
You can’t perform that action at this time.
0 commit comments