Opened 15 years ago
Closed 14 years ago
#15683 closed Cleanup/optimization (fixed)
the force_escpe filter should not call mark_safe
| Reported by: | Germano Gabbianelli | Owned by: | Marcos Moyano |
|---|---|---|---|
| Component: | Template system | Version: | 1.3 |
| Severity: | Normal | Keywords: | force_escape mark_safe |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | yes | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
in template.defaultfilters.force_escape you are explicitly calling mark_safe on the value returned by utils.html.escape, but escape already calls mark_safe on the string it returns
http://code.djangoproject.com/browser/django/trunk/django/utils/html.py#L30
http://code.djangoproject.com/browser/django/trunk/django/template/defaultfilters.py#L391
I reported this on #django-dev and got answered:
<carljm> tyrion-mx: indeed, i think the mark_safe in force_escape is unnecessary. though also harmless - it costs exactly one function call and one isinstance check.
Attachments (1)
Change History (10)
comment:1 by , 15 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
by , 15 years ago
| Attachment: | ticket_15683.patch added |
|---|
comment:2 by , 15 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 15 years ago
| Has patch: | set |
|---|---|
| Needs tests: | set |
comment:4 by , 15 years ago
| Type: | → Cleanup/optimization |
|---|
comment:5 by , 15 years ago
| Severity: | → Normal |
|---|
comment:6 by , 15 years ago
| Easy pickings: | unset |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
comment:7 by , 15 years ago
| Triage Stage: | Ready for checkin → Accepted |
|---|
back to accepted since tests are missing..
Note:
See TracTickets
for help on using tickets.
remove marke_safe