--
Ticket URL: <https://code.djangoproject.com/ticket/18105>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* component: Uncategorized => Template system
* type: Uncategorized => Cleanup/optimization
Comment:
After re-reading the docs about Context, I think things are clear: Context
takes a dict as optional init parameter. So for me, passing a Context to
another Context init is a mistake and should be fixed (see my patch on
#18103).
--
Ticket URL: <https://code.djangoproject.com/ticket/18105#comment:1>
Comment (by aaugustin):
I think we need a deprecation path, but I'm in favor of this change.
--
Ticket URL: <https://code.djangoproject.com/ticket/18105#comment:2>
* has_patch: 0 => 1
* stage: Unreviewed => Accepted
Comment:
I have separated in two distinct patches the problematic uses of Context
initialization from a context instance in Django code.
At this point and considering the correction you committed in r17896, it's
still possible to intialize a Context from another Context, even with
these patches.
--
Ticket URL: <https://code.djangoproject.com/ticket/18105#comment:3>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/18105#comment:4>
Comment (by aaugustin):
[73317883] changed `render_to_response` so it wouldn't rewrap a `Context`
inadvertently passed in the `dictionary` argument in another `Context`.
That's the opposite of the route taken by first patch above and I'm
convinced it's a better approach given how widespread `render_to_response`
is and how easy forgetting `context_instance=` is.
The second patch still warrants consideration. I had a look and I don't
think the code inside `if isinstance(_dict, BaseContext)` is correct: it
adds values such as `autoescape` and `current_app` to the context when
they're intended to be attributes of the context object.
--
Ticket URL: <https://code.djangoproject.com/ticket/18105#comment:5>
* status: new => closed
* resolution: => fixed
Comment:
As far as I'm aware the second part was fixed by
e53495ba3352c2c0fdb6178f2b333c30cb6b5d46.
--
Ticket URL: <https://code.djangoproject.com/ticket/18105#comment:6>