diff options
| author | Claude Paroz <claude@2xlibre.net> | 2017-04-21 19:52:26 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-04-27 09:10:02 +0200 |
| commit | 301de774c21d055e9e5a7073e5bffdb52bc71079 (patch) | |
| tree | 4c0c65fd147d528cce920cbd6a16ffa493d832ca /django/utils/html.py | |
| parent | 8ab7ce8558792f41637d6f87f2a8a117e169dd18 (diff) | |
Refs #27795 -- Replaced many force_text() with str()
Thanks Tim Graham for the review.
Diffstat (limited to 'django/utils/html.py')
| -rw-r--r-- | django/utils/html.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/django/utils/html.py b/django/utils/html.py index 25843ce576..9f4f58c7a1 100644 --- a/django/utils/html.py +++ b/django/utils/html.py @@ -43,7 +43,7 @@ def escape(text): conditional_escape() instead. """ return mark_safe( - force_text(text).replace('&', '&').replace('<', '<') + str(text).replace('&', '&').replace('<', '<') .replace('>', '>').replace('"', '"').replace("'", ''') ) @@ -70,7 +70,7 @@ _js_escapes.update((ord('%c' % z), '\\u%04X' % z) for z in range(32)) @keep_lazy(str, SafeText) def escapejs(value): """Hex encode characters for use in JavaScript strings.""" - return mark_safe(force_text(value).translate(_js_escapes)) + return mark_safe(str(value).translate(_js_escapes)) def conditional_escape(text): @@ -121,8 +121,8 @@ def format_html_join(sep, format_string, args_generator): @keep_lazy_text def linebreaks(value, autoescape=False): """Convert newlines into <p> and <br />s.""" - value = normalize_newlines(force_text(value)) - paras = re.split('\n{2,}', value) + value = normalize_newlines(value) + paras = re.split('\n{2,}', str(value)) if autoescape: paras = ['<p>%s</p>' % escape(p).replace('\n', '<br />') for p in paras] else: |
