Made format_undertitle() Jinja filter None-safe

This commit is contained in:
Sybren A. Stüvel 2016-09-22 10:33:51 +02:00
parent 7f9f89853d
commit cd8707207b

View File

@ -22,6 +22,10 @@ def format_undertitle(s):
Replaces underscores with spaces, and then applies Jinja2's own title filter.
"""
# Just keep empty strings and Nones as they are.
if not s:
return s
return jinja2.filters.do_title(s.replace('_', ' '))