> You can also use `push()` as a context manager to ensure a matching
pop() is called.
And the documentation says this about `context.update()`:
> This works like `push()` but takes a dictionary as an argument and
pushes that dictionary onto the stack instead of an empty one.
However, `update()` doesn't seem to act as a context manager like `push()`
does (which I would have found useful). Is there a reason for the
difference? If the difference is deliberate, it seems like the
documentation should note this difference.
--
Ticket URL: <https://code.djangoproject.com/ticket/24603>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: chris.jerdonek@… (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/24603#comment:1>
* stage: Unreviewed => Accepted
* type: Uncategorized => New feature
* version: 1.7 => master
Comment:
I guess it's probably not a feature that's been requested. See
a3e7d73ed7d90d31de46c60d40424267f62e411c for the addition of the context
manager to `push()`.
--
Ticket URL: <https://code.djangoproject.com/ticket/24603#comment:2>
* easy: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/24603#comment:3>
* owner: nobody => tbeadle
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/24603#comment:4>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/24603#comment:5>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/24603#comment:6>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"6bfd864ff2a7d4903d485ee40094a1315da8221b" 6bfd864]:
{{{
#!CommitTicketReference repository=""
revision="6bfd864ff2a7d4903d485ee40094a1315da8221b"
Fixed #24603 -- Allowed Context.update() to be used as a context manager.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24603#comment:7>
Comment (by cjerdonek):
Wow, only six days -- thanks for adding this so quickly!
--
Ticket URL: <https://code.djangoproject.com/ticket/24603#comment:8>