Add support for light-weight feature checks.

Review Request #8031 — Created March 4, 2016 and submitted — Latest diff uploaded

Information

Djblets
release-0.10.x

Reviewers

Feature checks (aka feature switches/toggles) are a way to allow new
features to be built and tested in a codebase without exposing them to
every user.

This introduces support for light-weight feature checks. There are three
parts: Features, Feature Checkers, and the Feature Registry.

The Feature class is used to define a feature. It just requires a
feature ID and an optional name, summary, and stability level. It may
also contain functions for handling initialization and shutdown (for
when the feature is registered and unregistered, respectively). Once
instantiated, the feature is registered and ready to check.

Feature checkers determine whether a feature should be enabled, based on
the severity level and any other custom criteria. When an application
checks if a feature should be enabled, it can pass any criteria it
wants (user, request, etc.), and if the checker understands it, it can
consider it. This gives applications a lot of control of how features
and their checkers are to be used, without imposing major requirements
on them like other frameworks.

The feature registry contains all the features that have been
instantiated, and can be used to look up or list features dynamically.

There are template tags available as well for limiting bits of a
template based on whether a feature is enabled.

Documentation is provided covering how features work, and how to write
both features and feature checkers.

Unit tests pass.

Checked the docs for errors and bad code references.