﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
2327	Need a warning that dictionaries passed from a custom context processor may be modified	mir@…	Michael Radziej	"An unexpected interaction between RequestContext and update_view modifies the dict the last ContextProcessor provides when you have extra_context.

update_object contains this code to build the context for the template (lines 140ff)

{{{
    c = RequestContext(request, {
        'form': form,
        template_object_name: object,
    }, context_processors)
    for key, value in extra_context.items():
        if callable(value):
            c[key] = value()
        else:
            c[key] = value
}}}

The first line creates the request context. RequestContext evaluates the context processors and puts the content of the last context processor on top of its stack, since Context.update does

{{{
        self.dicts = [other_dict] + self.dicts
}}}

Back in update_object, the last lines directly assign to this dict.

My context processor happend to do something like this:

{{{
NAVIGATION_CONTEXT = {...}

...

def navigation_context_processor(request):
    return NAVIGATION_CONTEXT
}}}

Since update_object now modifies NAVIGATION_CONTEXT, this led to strange effects.

In my opinion, this a bug of update_object, but you may consider it only a documentation issue. But please let's at least document it.

The other generic views have the same problem.
"	defect	closed	Documentation	dev	normal	wontfix			Accepted	0	1	0	0	0	0
