#16726 closed Cleanup/optimization (duplicate)
Make is_safe decorator for filters
Reported by: | Owned by: | Jannis Leidel | |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Why not turn boring process of coding
@register.filter('amazing') def amazing(value): # Not doing anything unsafe ;) ... return new_value amazing.is_safe = True
into something more interesting like
@register.safe_filter('amazing') def amazing(value): # Not doing anything unsafe ;) ... return new_value
?
Change History (9)
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | New feature → Cleanup/optimization |
Version: | 1.2 → SVN |
follow-up: 4 comment:2 by , 13 years ago
comment:4 by , 13 years ago
Replying to russellm:
I'd much rather see a separate @is_safe decorator, rather than a single-purpose @safe_filter.
It's not a big deal to implement both of them :)
comment:5 by , 13 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 13 years ago
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
Actually this is a dupe of #6135.
follow-up: 8 comment:7 by , 13 years ago
.. at least in the sense that both is_safe and needs_autoescape only set a flag on the filter functions.
comment:8 by , 13 years ago
Replying to jezdez:
.. at least in the sense that both is_safe and needs_autoescape only set a flag on the filter functions.
But they are supposed to do different things, correct?
I'd much rather see a separate @is_safe decorator, rather than a single-purpose @safe_filter.