mirror of
				https://github.com/django/django.git
				synced 2025-10-27 07:36:08 +00:00 
			
		
		
		
	Fixed #22130 -- Deprecated fix_ampersands, removed utils.clean_html()
This commit is contained in:
		| @@ -3,6 +3,7 @@ | ||||
| from __future__ import unicode_literals | ||||
|  | ||||
| import re | ||||
| import warnings | ||||
|  | ||||
| from django.utils.safestring import SafeData, mark_safe | ||||
| from django.utils.encoding import force_text, force_str | ||||
| @@ -174,6 +175,9 @@ strip_entities = allow_lazy(strip_entities, six.text_type) | ||||
|  | ||||
| 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) | ||||
|     return unencoded_ampersands_re.sub('&', force_text(value)) | ||||
| fix_ampersands = allow_lazy(fix_ampersands, six.text_type) | ||||
|  | ||||
| @@ -290,6 +294,9 @@ def clean_html(text): | ||||
|         * Remove stuff like "<p>  </p>", but only if it's at the | ||||
|           bottom of the 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) | ||||
|     text = normalize_newlines(text) | ||||
|     text = re.sub(r'<(/?)\s*b\s*>', '<\\1strong>', text) | ||||
|     text = re.sub(r'<(/?)\s*i\s*>', '<\\1em>', text) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user