Ticket #194 (closed proposal: worksforme)

Opened 2 years ago

Last modified 2 years ago

htmlspecialchars like

Reported by: climbus Owned by: bbangert
Priority: normal Milestone:
Component: helpers Version: 0.9.4
Severity: normal Keywords:
Cc:

Description

Pylons need default helper for escaping html special chars. In PHP we have htmlspecialchars function. In webhelpers we have escape_html but this function escapes too many chars (all non ascii).

htmlspecialchars escpaes " < > ' &

Change History

comment:1 Changed 2 years ago by pjenvey

  • status changed from new to closed
  • resolution set to worksforme
  • milestone 0.9.5 deleted

cgi.escape should do this for you

Also myghty and mako have built in html escape filters (which is just using cgi.escape):

http://www.myghty.org/docs/index.myt?paged=no#filtering_escaping

If you need it in a template language that doesn't have it, I would just do

from cgi import escape

in your helpers.py file. Reopen this if you think there's more we should do

Note: See TracTickets for help on using tickets.


Powered by Pylons - Contact Administrators