Django

Code

Ticket #8041 (closed: fixed)

Opened 4 months ago

Last modified 4 months ago

Media should render as safe strings

Reported by: Daniel Pope <dan@mauveinternet.co.uk> Assigned to: ericholscher
Milestone: 1.0 Component: Forms
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

All of the render_* methods of django.forms.widgets.Media return unicode strings containing HTML markup.

As these are intended for use in templates, they should return SafeStrings. By the same token, the paths that are substituted should be escaped using conditional_escape to ensure the generated HTML is valid, even if paths contain characters such as '&'.

Attachments

media-safestrings.diff (4.9 kB) - added by ericholscher on 08/08/08 10:51:56.
Simple patch

Change History

08/08/08 10:51:56 changed by ericholscher

  • attachment media-safestrings.diff added.

Simple patch

08/08/08 10:54:08 changed by ericholscher

  • status changed from new to assigned.
  • needs_better_patch changed.
  • component changed from Uncategorized to django.newforms.
  • needs_tests changed.
  • milestone set to 1.0.
  • owner changed from nobody to ericholscher.
  • needs_docs changed.
  • has_patch set to 1.

Sorry about the silly whitespace stuff in the patch. This is a simple change, and all of the tests are passing on trunk.

08/08/08 11:46:12 changed by ericholscher

  • stage changed from Unreviewed to Accepted.

08/10/08 07:29:48 changed by russellm

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

(In [8285]) Fixed #8041 -- Modified media rendering to return safe strings. Thanks to Daniel Pope <dan@mauveinternet.co.uk> for the report.


Add/Change #8041 (Media should render as safe strings)




Change Properties
Action