Opened 6 years ago

Closed 5 years ago

#15652 closed Bug (fixed)

dictsort raises TemplateSyntaxError when not provided with a list of dictionaries

Reported by: notifications@… Owned by: Daniel Barreto
Component: Template system Version: 1.3-rc
Severity: Normal Keywords:
Cc: daniel.barreto.n@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

For example, if one puts {{ "Hello"|dictsort:"a" }} into a template and render it, it will raise TemplateSyntaxError with Caught VariableDoesNotExist while rendering: Failed lookup for key [a] in u'H'. It should fail silently.

Attachments (1)

0001-Fixed-15652-dictsort-and-dictsortreversed-won-t-rais.patch (3.4 KB) - added by Daniel Barreto 5 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 6 years ago by Julien Phalip

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 6 years ago by Luke Plant

Type: Bug

comment:3 Changed 6 years ago by Luke Plant

Severity: Normal

comment:4 Changed 5 years ago by Daniel Barreto

Cc: daniel.barreto.n@… added
Easy pickings: unset
Has patch: set
Owner: changed from nobody to Daniel Barreto
Status: newassigned
UI/UX: unset

adding a patch with some basic tests.

comment:5 Changed 5 years ago by Claude Paroz

Triage Stage: AcceptedReady for checkin

Looks fine.

comment:6 Changed 5 years ago by Ramiro Morales

Resolution: fixed
Status: assignedclosed

In [17374]:

Made dictsort and dictsort reversed template filters fail silently
when passed list of things that aren't dictionaries.

Thanks Harris Lapiroff for the report and Daniel Barreto for the patch.

Fixes #15652.

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