Add support for custom context processors, and make them and apps ref-counted.

Review Request #5024 — Created Nov. 23, 2013 and submitted — Latest diff uploaded

Information

Djblets
master

Reviewers

Add support for custom context processors, and make them and apps ref-counted.

This introduces a new Extension.context_processors list, which defines
context processors the extension wants to have available for all
templates.

It also adds protection for both context_processors and apps.
Previously, extensions were assumed to never list an app that another
extension may list, or that the main application lists. Otherwise,
disabling the extension would remove the main item from that list.

The list of context processors and apps are now ref-counted.
ExtensionManager wraps its own access to
settings.TEMPLATE_CONTEXT_PROCESSORS and settings.INSTALLED_APPS.
It won't add new entries if they already exist, and won't remove
entries unless the ref count drops to 0.

Tested this with an extension reusing some apps from another.

Unit tests pass.

    Loading...