Django

Code

Ticket #4657 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

urlizetrunc filter appending elipsis to uris of exactly the truncate length

Reported by: SmileyChris Assigned to: adrian
Milestone: Component: Template system
Version: SVN Keywords: urlize html utils
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

>>> from django.template.defaultfilters import urlizetrunc
>>> uri = 'http://31characteruri.com/test/'
>>> len(uri)
31
>>> urlizetrunc(uri, 31)
'<a href="http://31characteruri.com/test/" rel="nofollow">http://31characteruri.com/test/...</a>'

The attached patch addresses this. Also, if the URI does need truncating, this patch changes it so that the truncation length is - 3 to adjust for the addition of the 3 elipsis characters (see the test in the patch for a better explanation).

Attachments

urlize_trunc.patch (1.5 kB) - added by SmileyChris on 06/21/07 18:46:14.
urlize_trunc.2.patch (2.6 kB) - added by SmileyChris on 06/21/07 18:47:14.
with tests this time

Change History

06/21/07 18:46:14 changed by SmileyChris

  • attachment urlize_trunc.patch added.

06/21/07 18:47:14 changed by SmileyChris

  • attachment urlize_trunc.2.patch added.

with tests this time

06/21/07 19:28:14 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Ready for checkin.
  • needs_tests changed.
  • needs_docs changed.

06/22/07 22:10:32 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [5513]) Fixed #4657 -- Fixed an error in an edge case of the urlizetrunc filter. Thanks, SmileyChris?.


Add/Change #4657 (urlizetrunc filter appending elipsis to uris of exactly the truncate length)




Change Properties
Action