summaryrefslogtreecommitdiff
path: root/django/utils/html.py
diff options
context:
space:
mode:
authortim-mccurrach <34194722+tim-mccurrach@users.noreply.github.com>2021-11-03 07:14:50 +0000
committerGitHub <noreply@github.com>2021-11-03 08:14:50 +0100
commit1f9874d4ca3e7376036646aedf6ac3060f22fd69 (patch)
tree567f2761c90eeec2f0eb8f174fa2caa8e21051f8 /django/utils/html.py
parent9f3bd9dfc42b4e0ff89566763d211ab9e8f50d5e (diff)
Refs #33245 -- Minor edits to django.utils.html.urlize() changes.
Follow up to ad81b606a2b5276397460a654fc7ad901a54b91e.
Diffstat (limited to 'django/utils/html.py')
-rw-r--r--django/utils/html.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/django/utils/html.py b/django/utils/html.py
index c439e9114c..da1b5675ec 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -264,7 +264,7 @@ class Urlizer:
])
def handle_word(
- self, word, safe_input, trim_url_limit=None, nofollow=False, autoescape=False,
+ self, word, *, safe_input, trim_url_limit=None, nofollow=False, autoescape=False,
):
if '.' in word or '@' in word or ':' in word:
# lead: Punctuation trimmed from the beginning of the word.
@@ -288,7 +288,7 @@ class Urlizer:
nofollow_attr = ''
# Make link.
if url:
- trimmed = self.trim_url(middle, trim_url_limit=trim_url_limit)
+ trimmed = self.trim_url(middle, limit=trim_url_limit)
if autoescape and not safe_input:
lead, trail = escape(lead), escape(trail)
trimmed = escape(trimmed)
@@ -309,10 +309,10 @@ class Urlizer:
return escape(word)
return word
- def trim_url(self, x, trim_url_limit):
- if trim_url_limit is None or len(x) <= trim_url_limit:
+ def trim_url(self, x, *, limit):
+ if limit is None or len(x) <= limit:
return x
- return '%s…' % x[:max(0, trim_url_limit - 1)]
+ return '%s…' % x[:max(0, limit - 1)]
def trim_punctuation(self, word):
"""