Opened 20 years ago
Closed 19 years ago
#1266 closed defect (wontfix)
Default filter URLENCODE enhacement
| Reported by: | mordaha | Owned by: | Adrian Holovaty |
|---|---|---|---|
| Component: | Template system | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Old style:
var = "123/123"
{{ var|urlencode }}
produces output:
123/123
New style:
{{ var|urlencode:"" }}
produces output:
123%4F123
{{ var|urlencode:"/" }}
produces output:
123/123
New code:
def urlencode(value, arg=''):
"Escapes a value for use in a URL"
import urllib
return urllib.quote(value, arg)
Note:
See TracTickets
for help on using tickets.