Revert part of r13112 and restore the use of allow_lazy. Breaks agenda page

otherwise. Commit ready for merge.
 - Legacy-Id: 13123
This commit is contained in:
Lars Eggert 2017-03-25 21:25:28 +00:00
parent 76a3c8bdc0
commit 455959c267
2 changed files with 4 additions and 4 deletions

View file

@ -5,7 +5,7 @@ import html5lib
import bleach
from html5lib import sanitizer, serializer, tokenizer, treebuilders, treewalkers
from django.utils.functional import keep_lazy
from django.utils.functional import allow_lazy
from django.utils import six
acceptable_elements = ('a', 'abbr', 'acronym', 'address', 'b', 'big',
@ -67,7 +67,7 @@ def remove_tags(html, tags):
"""Returns the given HTML sanitized, and with the given tags removed."""
allowed = set(acceptable_elements) - set([ t.lower() for t in tags ])
return bleach.clean(html, tags=allowed)
remove_tags = keep_lazy(remove_tags, six.text_type)
remove_tags = allow_lazy(remove_tags, six.text_type)
def clean_html(html):
return bleach.clean(html)

View file

@ -4,7 +4,7 @@ import re
import unicodedata
import textwrap
from django.utils.functional import keep_lazy
from django.utils.functional import allow_lazy
from django.utils import six
from django.utils.safestring import mark_safe
@ -18,7 +18,7 @@ def xslugify(value):
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii')
value = re.sub('[^\w\s/-]', '', value).strip().lower()
return mark_safe(re.sub('[-\s/]+', '-', value))
xslugify = keep_lazy(xslugify, six.text_type)
xslugify = allow_lazy(xslugify, six.text_type)
def strip_prefix(text, prefix):
if text.startswith(prefix):