Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#9216 closed Uncategorized (wontfix)

Forms: Assert that js and css attributes of Media contain list or tuple

Reported by: guettli Owned by: nobody
Component: Forms Version: 1.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

this patch checks if the attributes js and css of the Media class contain a list or tuple, and not
a string.

Test included.

Attachments (1)

widget_assert_list_or_tuple.diff (2.0 KB) - added by guettli 7 years ago.

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by guettli

comment:1 Changed 7 years ago by jacob

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

isinstance() checks are not good Python -- any iterable should work for js, for example -- and this check isn't needed. If someone uses a bad type, they'll get an error. That's how Python works.

comment:2 Changed 7 years ago by guettli

Strings are iterable. But if you use a string, you won't get the expected result.

A patch like this would make django more friendly for people with little experience.

Maybe I should have done it different: Check if the object is iterable, but is not a string.

comment:3 Changed 4 years ago by guettli

  • Cc hv@… removed
  • Easy pickings unset
  • Severity set to Normal
  • Type set to Uncategorized
  • UI/UX unset
Note: See TracTickets for help on using tickets.
Back to Top