1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Fixed #21188 -- Introduced subclasses for to-be-removed-in-django-XX warnings

Thanks Anssi Kääriäinen for the idea and Simon Charette for the
review.
This commit is contained in:
Claude Paroz
2014-02-26 22:48:20 +01:00
parent 70ec4d776e
commit 210d0489c5
84 changed files with 287 additions and 189 deletions

View File

@@ -5,9 +5,10 @@ from __future__ import unicode_literals
import re
import warnings
from django.utils.safestring import SafeData, mark_safe
from django.utils.deprecation import RemovedInDjango18Warning
from django.utils.encoding import force_text, force_str
from django.utils.functional import allow_lazy
from django.utils.safestring import SafeData, mark_safe
from django.utils import six
from django.utils.six.moves.urllib.parse import quote, unquote, urlsplit, urlunsplit
from django.utils.text import normalize_newlines
@@ -177,7 +178,7 @@ def fix_ampersands(value):
"""Returns the given HTML with all unencoded ampersands encoded correctly."""
# As fix_ampersands is wrapped in allow_lazy, stacklevel 3 is more useful than 2.
warnings.warn("The fix_ampersands function is deprecated and will be removed in Django 1.8.",
DeprecationWarning, stacklevel=3)
RemovedInDjango18Warning, stacklevel=3)
return unencoded_ampersands_re.sub('&', force_text(value))
fix_ampersands = allow_lazy(fix_ampersands, six.text_type)
@@ -296,7 +297,7 @@ def clean_html(text):
"""
# As clean_html is wrapped in allow_lazy, stacklevel 3 is more useful than 2.
warnings.warn("The clean_html function is deprecated and will be removed in Django 1.8.",
DeprecationWarning, stacklevel=3)
RemovedInDjango18Warning, stacklevel=3)
text = normalize_newlines(text)
text = re.sub(r'<(/?)\s*b\s*>', '<\\1strong>', text)
text = re.sub(r'<(/?)\s*i\s*>', '<\\1em>', text)