Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#24603 closed New feature (fixed)

Add the ability to use context.update() as a context manager

Reported by: Chris Jerdonek Owned by: Tommy Beadle
Component: Template system Version: dev
Severity: Normal Keywords: template, context, push, update
Cc: chris.jerdonek@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The documentation says you can use context.push() as a context manager:

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.

Change History (8)

comment:1 by Chris Jerdonek, 10 years ago

Cc: chris.jerdonek@… added

comment:2 by Tim Graham, 10 years ago

Summary: context.update() does not return a context manager like push()Add the ability to use context.update() as a context manager
Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature
Version: 1.7master

I guess it's probably not a feature that's been requested. See a3e7d73ed7d90d31de46c60d40424267f62e411c for the addition of the context manager to push().

comment:3 by Preston Timmons, 10 years ago

Easy pickings: set

comment:4 by Tommy Beadle, 10 years ago

Owner: changed from nobody to Tommy Beadle
Status: newassigned

comment:5 by Tommy Beadle, 10 years ago

Has patch: set

comment:6 by Tim Graham, 10 years ago

Triage Stage: AcceptedReady for checkin

comment:7 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 6bfd864:

Fixed #24603 -- Allowed Context.update() to be used as a context manager.

comment:8 by Chris Jerdonek, 10 years ago

Wow, only six days -- thanks for adding this so quickly!

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