Fix the extension 'enabled' state in the API after enabling/disabling.

Review Request #5969 — Created June 10, 2014 and submitted

Information

Djblets
release-0.8.x
8901add...

Reviewers

A recent regression caused ExtensionResource's 'enabled' state to be
incorrect after enabling/disabling an extension. The value would be that
of the old state. This led to an unexpected combination of states in the
extension list, which caused the "Enable", "Disable", etc. actions to
disappear.

The reason this happened is that get_object() now caches results, and
ExtensionResource was attempting to use it in order to reload the
RegisteredExtension instance. We now reload it like all other resources
do, which is to just re-fetch from the database using the existing
instance's ID.

Enabled and disabled extensions. Saw the links appear and reflect the
correct state.

Checked the resulting payload from the API, and it too had the right state.

reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        djblets/extensions/resources.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        djblets/extensions/resources.py
      Ignored Files:
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.8.x (21a5d5d)
Loading...