Opened 14 years ago
Last modified 10 years ago
#13841 assigned New feature
Allow context processors access to current version of context
Reported by: | Mitar | Owned by: | Colin Copeland |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | mmitar@…, vbmendes@…, simon@…, copelco@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Allow context processors access to current version of context so that they can change values and not just override them. This can be easily done with another argument, context, and also backwards compatible. Functions would only get additional argument if they are defined to get two arguments and whatever they would return would override that in the context.
Attachments (3)
Change History (18)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Cc: | added |
---|
I think this is a very useful feature. It also allows to develop context processor that add a context variable based in another context variable.
comment:3 by , 14 years ago
mitar:
I could make a patch if there would be an agreement that this is useful.
It seems that you want to discuss this first before implementing. The best place for discussion is the django-developers mailinglist[1] - writing your proposal there will result in better feedback and you can get an idea if core developers also find this useful and would accept a patch.
comment:5 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
This seems like a reasonable feature request; however, the implementation will need to be very careful about backwards compatibility.
comment:6 by , 14 years ago
Cc: | added |
---|
Mitar, this sounds good. Any thoughts on syntax? Maybe something like --
def mycontextprocesser(request, context=None): ...
by , 14 years ago
Attachment: | ticket13841.diff added |
---|
comment:7 by , 14 years ago
Patch attached. Backwards compatible, shouldn't add overhead either (getargspec is only called once for each processor) --
def mycontextprocessor(request): ... def mycontextprocessor(request, context): print context.get('request')
comment:8 by , 14 years ago
Has patch: | set |
---|---|
milestone: | → 1.4 |
Owner: | changed from | to
Version: | 1.2 → SVN |
comment:9 by , 14 years ago
Owner: | changed from | to
---|
@simon29 - Please don't assign bugs to me without speaking to me first.
comment:10 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:11 by , 14 years ago
Needs tests: | set |
---|
The patch needs tests. Could you also combine everything (new feature, tests and doc) within one single diff patch?
comment:12 by , 13 years ago
Easy pickings: | unset |
---|---|
Owner: | changed from | to
Status: | new → assigned |
UI/UX: | unset |
comment:15 by , 10 years ago
Patch needs improvement: | set |
---|
I could make a patch if there would be an agreement that this is useful.