diff --git a/wcs/qommon/misc.py b/wcs/qommon/misc.py index 51eb25cab..f037729d0 100644 --- a/wcs/qommon/misc.py +++ b/wcs/qommon/misc.py @@ -39,10 +39,11 @@ from django.utils import datetime_safe from django.utils import six from django.utils.encoding import force_text from django.utils.html import strip_tags -from django.template import engines, TemplateSyntaxError, VariableDoesNotExist +from django.template import TemplateSyntaxError, VariableDoesNotExist from django.utils.six.moves.html_parser import HTMLParser from django.utils.six.moves.urllib.parse import quote, urlencode from django.utils.six.moves.urllib import parse as urlparse +from django.utils.text import Truncator from quixote import get_publisher, get_response, get_request, redirect from quixote.html import htmltext @@ -263,7 +264,7 @@ def ellipsize(s, length=30): s = force_text(s, get_publisher().site_charset, errors='replace') if s and len(s) > length: if length > 3: - s = s[:length-3] + '(…)' + s = Truncator(s).chars(length, truncate='(…)') else: s = s[:length] return force_str(s)