Opened 4 years ago

Closed 4 years ago

#15652 closed Bug (fixed)

dictsort raises TemplateSyntaxError when not provided with a list of dictionaries

Reported by: notifications@… Owned by: volrath
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 volrath 4 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 4 years ago by julien

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by lukeplant

  • Type set to Bug

comment:3 Changed 4 years ago by lukeplant

  • Severity set to Normal

comment:4 Changed 4 years ago by volrath

  • Cc daniel.barreto.n@… added
  • Easy pickings unset
  • Has patch set
  • Owner changed from nobody to volrath
  • Status changed from new to assigned
  • UI/UX unset

adding a patch with some basic tests.

comment:5 Changed 4 years ago by claudep

  • Triage Stage changed from Accepted to Ready for checkin

Looks fine.

comment:6 Changed 4 years ago by ramiro

  • Resolution set to fixed
  • Status changed from assigned to closed

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