Skip to content

Commit 46247a2

Browse files
committed
Port away from django.utils.truncate_(html_)words which is now gone, use the template filter versions instead
- Legacy-Id: 6885
1 parent b3b7154 commit 46247a2

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

ietf/doc/feeds.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
from django.contrib.syndication.views import Feed, FeedDoesNotExist
77
from django.utils.feedgenerator import Atom1Feed
88
from django.core.urlresolvers import reverse as urlreverse
9-
from django.template.defaultfilters import truncatewords_html, date as datefilter, linebreaks
9+
from django.template.defaultfilters import truncatewords, truncatewords_html, date as datefilter, linebreaks
1010
from django.utils.html import strip_tags
11-
from django.utils.text import truncate_words
1211

1312
from ietf.doc.models import *
1413
from ietf.doc.utils import augment_events_with_revision
@@ -42,7 +41,7 @@ def items(self, obj):
4241
return events
4342

4443
def item_title(self, item):
45-
return u"[%s] %s [rev. %s]" % (item.by, truncate_words(strip_tags(item.desc), 15), item.rev)
44+
return u"[%s] %s [rev. %s]" % (item.by, truncatewords(strip_tags(item.desc), 15), item.rev)
4645

4746
def item_description(self, item):
4847
return truncatewords_html(format_textarea(item.desc), 20)

ietf/doc/templatetags/ietf_filters.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
from django import template
1010
from django.conf import settings
1111
from django.utils.html import escape, fix_ampersands
12-
from django.utils.text import truncate_html_words
13-
from django.template.defaultfilters import linebreaksbr, wordwrap, stringfilter, urlize
12+
from django.template.defaultfilters import truncatewords_html, linebreaksbr, wordwrap, stringfilter, urlize
1413
from django.template import resolve_variable
1514
from django.utils.safestring import mark_safe, SafeData
1615
from django.utils.html import strip_tags
@@ -457,7 +456,7 @@ def format_history_text(text):
457456
full = urlize_ietf_docs(full)
458457

459458
full = mark_safe(keep_spacing(linebreaksbr(urlize(sanitize_html(full)))))
460-
snippet = truncate_html_words(full, 25)
459+
snippet = truncatewords_html(full, 25)
461460
if snippet != full:
462461
return mark_safe(u'<div class="snippet">%s<span class="show-all">[show all]</span></div><div style="display:none" class="full">%s</div>' % (snippet, full))
463462
return full

ietf/wgcharter/feeds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from django.utils.feedgenerator import Atom1Feed
88
from django.core.urlresolvers import reverse as urlreverse
99
from django.utils.html import strip_tags
10-
from django.utils.text import truncate_words
10+
from django.template.defaultfilters import truncatewords
1111

1212
from ietf.group.models import Group, GroupEvent
1313
from ietf.doc.models import DocEvent
@@ -50,7 +50,7 @@ def item_pubdate(self, obj):
5050
return obj.time
5151

5252
def item_title(self, obj):
53-
title = u"%s - %s" % (truncate_words(strip_tags(obj.desc), 10), obj.by)
53+
title = u"%s - %s" % (truncatewords(strip_tags(obj.desc), 10), obj.by)
5454
if isinstance(obj, DocEvent):
5555
title = u"Chartering: %s" % title
5656

0 commit comments

Comments
 (0)