Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#24847 closed Bug (fixed)

Items set on a RequestContext after creation get lost

Reported by: Phil Davis Owned by: Paweł Marczewski
Component: Template system Version: 1.8
Severity: Release blocker 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

You cannot use c['foo'] = newvalue on a RequestContext after creation as it gets stomped on by the different context processors logic in 1.8

>>> from django.template import Template, RequestContext
>>> from django.http import HttpRequest
>>> r = HttpRequest()
>>> c = RequestContext(r, {'a': 'AAA'})
>>> t = Template('a is <{{a}}> and b is <{{b}}>')
>>> c['b'] = 'BBB'
>>> t.render(c)
u'a is <AAA> and b is <>'

In the above note that 'b' is not rendered in the template.

Attachments (1)

repro-24847.patch (676 bytes ) - added by Baptiste Mispelon 10 years ago.
Reproduction testcase

Download all attachments as: .zip

Change History (6)

comment:1 by Baptiste Mispelon, 10 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

Hi,

I can confirm that this issue exists and it wasn't present in 1.7 so I'm bumping the severity.
With the help of the attached test case, I bisected the issue to commit 37505b6397058bcc3460f23d48a7de9641cd6ef0.

Thanks.

by Baptiste Mispelon, 10 years ago

Attachment: repro-24847.patch added

Reproduction testcase

comment:2 by Paweł Marczewski, 9 years ago

Owner: changed from nobody to Paweł Marczewski
Status: newassigned

comment:4 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In 300e8baf:

Fixed #24847 -- Prevented items set on a RequestContext from being lost.

comment:5 by Tim Graham <timograham@…>, 9 years ago

In 7ee6043:

Fixed #24847 -- Prevented items set on a RequestContext from being lost.

Backport of 300e8baf9429dbf1c5dff478558d793638dc2f54 from master

Note: See TracTickets for help on using tickets.
Back to Top