Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#29654 closed Cleanup/optimization (fixed)

Truncate should use horizontal ellipsis character instead of three dots

Reported by: Sudhanshu Mishra Owned by: nobody
Component: Utilities Version: dev
Severity: Normal Keywords: string, truncator
Cc: Dan Davis Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

In the following example the value returns a string which has a length of 18 and including 3 dots.

>>> from django.utils.text import Truncator
>>> Truncator("Hello world is not so long").chars(18)
'Hello world is ...'
>>> Truncator("Hello world is not so long").chars(18)[-1]
'.'

IMHO, the Truncator should use ... (ellipsis) character instead.

Change History (13)

comment:1 by Sudhanshu Mishra, 6 years ago

Has patch: set

comment:2 by Claude Paroz, 6 years ago

Component: Template systemUtilities
Patch needs improvement: set
Triage Stage: UnreviewedAccepted
UI/UX: unset
Version: 2.1master

I'd be in favour of this change.

PR

comment:3 by Claude Paroz, 6 years ago

But there are many more occurrences in the Django source code and comments. We should be consistent. Does this need a discussion?

comment:4 by Vishvajit Pathak, 6 years ago

Sudhanshu,
Do you mean the expected output should be like below :

>>> Truncator("Hello world is not so long").chars(18)[-1]
'...'

comment:5 by Claude Paroz, 6 years ago

Patch needs improvement: unset

I added that PR.

comment:6 by Tim Graham, 6 years ago

Triage Stage: AcceptedReady for checkin

comment:7 by Claude Paroz <claude@…>, 6 years ago

Resolution: fixed
Status: newclosed

In 201017df:

Fixed #29654 -- Made text truncation an ellipsis character instead of three dots.

Thanks Sudhanshu Mishra for the initial patch and Tim Graham for the review.

comment:8 by Tim Graham <timograham@…>, 6 years ago

In 50b84935:

Refs #29654 -- Replaced three dots with ellipsis character in output strings.

comment:9 by Tim Graham <timograham@…>, 6 years ago

In 5311a36:

Refs #29654 -- Replaced three dots with ellipsis in DB creation output strings.

comment:10 by Tim Graham, 6 years ago

There have been some reports of the ellipses causing crashes on the shell (#30184) so parts of this might be reverted.

comment:11 by Dan Davis, 6 years ago

Cc: Dan Davis added

comment:12 by Tim Graham <timograham@…>, 6 years ago

In 2bd8df24:

Fixed #30184 -- Removed ellipsis characters from shell output strings.

Partially reverted 50b8493581fea3d7137dd8db33bac7008868d23a (refs #29654)
to avoid a crash when the user shell doesn't support non-ASCII characters.

comment:13 by Tim Graham <timograham@…>, 6 years ago

In 5e94c817:

[2.2.x] Fixed #30184 -- Removed ellipsis characters from shell output strings.

Partially reverted 50b8493581fea3d7137dd8db33bac7008868d23a (refs #29654)
to avoid a crash when the user shell doesn't support non-ASCII characters.
Backport of 2bd8df243ac6fc35e58c9fe90b20c9e42519a5ac from master.

Note: See TracTickets for help on using tickets.
Back to Top