misc: remove DeprecationWarning unescape (#39438)
DeprecationWarning: The unescape method is deprecated and will be removed in 3.5, use html.unescape() instead.
This commit is contained in:
parent
f2807ce2ec
commit
11882c5810
|
@ -18,6 +18,7 @@ import collections
|
|||
import copy
|
||||
import feedparser
|
||||
import hashlib
|
||||
import html
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
|
@ -754,8 +755,7 @@ class CellBase(six.with_metaclass(CellMeta, models.Model)):
|
|||
}
|
||||
if not self.is_relevant(context):
|
||||
return ''
|
||||
from django.utils.six.moves.html_parser import HTMLParser
|
||||
return HTMLParser().unescape(strip_tags(self.render(context)))
|
||||
return html.unescape(strip_tags(self.render(context)))
|
||||
|
||||
def get_external_links_data(self):
|
||||
return []
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from django.utils.six.moves.html_parser import HTMLParser
|
||||
import html
|
||||
|
||||
from django.utils.six.moves.urllib import parse as urlparse
|
||||
|
||||
from django.conf import settings
|
||||
|
@ -23,7 +24,7 @@ from django.utils.html import strip_tags
|
|||
|
||||
|
||||
def ellipsize(text, length=50):
|
||||
text = HTMLParser().unescape(strip_tags(text))
|
||||
text = html.unescape(strip_tags(text))
|
||||
if len(text) < length:
|
||||
return text
|
||||
return text[:(length-10)] + '...'
|
||||
|
|
Loading…
Reference in New Issue