Add a signal for detecting reloaded SiteConfigurations.

Review Request #9481 — Created Jan. 13, 2018 and submitted

Information

Djblets
release-1.0.x
be04d43...

Reviewers

This introduces a siteconfig_reloaded signal, which consumers can
listen to in order to update their state when a SiteConfiguration has
expired and has been reloaded. The signal contains the new instance,
along with the old instance for settings comparison purposes.

A couple of changes were made to enable use of this signal.

First, the behavior of SiteConfigurationManager.check_expired has
slightly changed. Previously, expiration just meant clearing the value
from cache, causing the next get_current() to re-fetch. Now, if there
are any listeners for the signal, the new instance is fetched
immediately, so that it can be passed to the signal handler. This
shouldn't impact any consumers. If no listeners are present, the new
instance is not fetched.

A new method get_for_site_id() method was also added for use in
check_expired(). This works like get_current(), but takes the ID of
a Django Site, handling caching. get_current() wraps this.

The docs throughout the file have been modernized, helping to keep this
maintainable going forward.

All unit tests for Djblets and Review Board pass.

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-1.0.x (1b79cb3)