Allow context processors to take the context as a second argument
|Reported by:||fberger||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
It would be very useful if context processors could do what their name suggests and process the existing context and manipulate it instead of just adding and potentially overriding some existing entries in the context.
This would be useful for context processors that take entries contained in the context and compute an extra bit of information. If the entry is not there it wouldn't waste any time computing it for a view that doesn't need it and avoid extra db queries to get the data.
No guarantee would be given as to the order in which processors run, they could only rely on context data provided by views.
A workaround to achieve the same effect would be to set the context as field in the request.
I've attached a basic patch that allows context processors to optionally take a context argument.