mirror of
https://github.com/django/django.git
synced 2025-09-22 10:12:43 +00:00
Fixed #18042 -- Advanced deprecation warnings.
Thanks Ramiro for the patch.
This commit is contained in:
parent
227cec686e
commit
e84f79f051
27 changed files with 75 additions and 38 deletions
|
@ -206,14 +206,14 @@ class Truncator(SimpleLazyObject):
|
|||
|
||||
def truncate_words(s, num, end_text='...'):
|
||||
warnings.warn('This function has been deprecated. Use the Truncator class '
|
||||
'in django.utils.text instead.', category=PendingDeprecationWarning)
|
||||
'in django.utils.text instead.', category=DeprecationWarning)
|
||||
truncate = end_text and ' %s' % end_text or ''
|
||||
return Truncator(s).words(num, truncate=truncate)
|
||||
truncate_words = allow_lazy(truncate_words, unicode)
|
||||
|
||||
def truncate_html_words(s, num, end_text='...'):
|
||||
warnings.warn('This function has been deprecated. Use the Truncator class '
|
||||
'in django.utils.text instead.', category=PendingDeprecationWarning)
|
||||
'in django.utils.text instead.', category=DeprecationWarning)
|
||||
truncate = end_text and ' %s' % end_text or ''
|
||||
return Truncator(s).words(num, truncate=truncate, html=True)
|
||||
truncate_html_words = allow_lazy(truncate_html_words, unicode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue