Fix context leaks in ActionHooks.

Review Request #5762 — Created May 2, 2014 and submitted

Information

Review Board
release-2.0.x
e3fa7c5...

Reviewers

Context.update() implies a push(), but the ActionHooks weren't popping.
This meant that state would be leaked not only between hooks, but into
the main template as well.

We now do a pop() after rendering the template.

Unit tests pass.

Description From Last Updated

This isn't exception safe. Maybe move the try/except into the for loop and push/pop outside of it?

daviddavid

Hmm, this isn't quite right now, especially with the logged error message. Probably there should be two exception handlers, one …

daviddavid
david
  1. 
      
  2. reviewboard/extensions/templatetags/rb_extensions.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    This isn't exception safe. Maybe move the try/except into the for loop and push/pop outside of it?

    1. I originally did that, and then changed it back, because the templates they're rendering are under our control, and not the extension's. However, we may decide to change that someday, and the old code is more wrong, so fixing.

  3. 
      
chipx86
david
  1. 
      
  2. reviewboard/extensions/templatetags/rb_extensions.py (Diff revision 2)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Hmm, this isn't quite right now, especially with the logged error message.

    Probably there should be two exception handlers, one around get_actions(), and one around the render call.

    1. Ugh yeah. I wasn't paying enough attention.

  3. 
      
chipx86
david
  1. Ship It!

  2. 
      
chipx86
Review request changed
Status:
Completed