feat(django 1.9): Added mark_safe to {% hook_output %}

Django 1.9 now escapes the output for simple tags. Since hook_output would only hook in code from a wagtail_hooks file, I think it's safe to assume it's safe
pull/1990/merge
Karl Hobley 2015-12-02 16:52:33 +00:00 zatwierdzone przez Matt Westcott
rodzic 07ae9f679f
commit 91e9eebc41
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -4,6 +4,7 @@ from django.conf import settings
from django import template
from django.contrib.humanize.templatetags.humanize import intcomma
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from wagtail.wagtailcore import hooks
from wagtail.wagtailcore.models import get_navigation_menu_items, UserPagePermissionsProxy, PageViewRestriction
@ -127,7 +128,7 @@ def hook_output(hook_name):
Note that the output is not escaped - it is the hook function's responsibility to escape unsafe content.
"""
snippets = [fn() for fn in hooks.get_hooks(hook_name)]
return ''.join(snippets)
return mark_safe(''.join(snippets))
@register.assignment_tag