Update the extensions code to be compatible with Django 1.6 and higher.

Review Request #8707 — Created Feb. 2, 2017 and submitted — Latest diff uploaded

Information

Djblets
release-0.10.x
d9f2d73...

Reviewers

The extensions code, for many reasons, was not compatible with newer
versions of Django. We have to do a lot of manipulation of Django state
(template-related caches, model caches, installed apps, etc.) for
extensions, and this has all changed since Django 1.6.

This change adds support for manipulating all this in newer versions of
Django, and retains support for Django 1.6.

Along the way, some problems with how we were doing things were found.
Due probably to a bad merge at some point, much of the extension
initialization code was living in the media installation code and was
being called too late in the cycle. This didn't manifest as an obvious
problem on Django 1.6 (though it likely did result in apps not being
properly removed when an extension was disabled), but it was a major
problem on newer versions (which track apps and state more closely).
This code has been cleaned up and ordering has been fixed.

Models weren't being properly cleared from caches before, which wasn't a
big problem in practice but could in theory lead to
introspection-related problems. These caches are now properly cleared,
where possible.

We also now call the evolve command from Django Evolution more
correctly, ensuring compatibility not just with various versions of
Django but also with changes to the evolve command and its argument
list.

Unit tests have been added to check for all the cache-related changes,
model synchronization, and evolution operations.

Unit tests pass on Django 1.6 and 1.8 through 1.10.

    Loading...