diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-05-17 16:33:36 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-05-17 18:08:58 +0200 |
| commit | 9c487b5974ee7e7f196079611d7352364e8873ed (patch) | |
| tree | efc6ffa38da07b4302e145c33047cf2c41da105a /django/utils/html.py | |
| parent | b1bfd9630ef049070b0cd6ae215470d3d1facd40 (diff) | |
Replaced an antiquated pattern.
Thanks Lennart Regebro for pointing it out.
Diffstat (limited to 'django/utils/html.py')
| -rw-r--r-- | django/utils/html.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/utils/html.py b/django/utils/html.py index 650e8485ab..8b28d97d13 100644 --- a/django/utils/html.py +++ b/django/utils/html.py @@ -187,7 +187,10 @@ def urlize(text, trim_url_limit=None, nofollow=False, autoescape=False): If autoescape is True, the link text and URLs will get autoescaped. """ - trim_url = lambda x, limit=trim_url_limit: limit is not None and (len(x) > limit and ('%s...' % x[:max(0, limit - 3)])) or x + def trim_url(x, limit=trim_url_limit): + if limit is None or len(x) <= limit: + return x + return '%s...' % x[:max(0, limit - 3)] safe_input = isinstance(text, SafeData) words = word_split_re.split(force_text(text)) for i, word in enumerate(words): |
