Make never_cache_patterns() compatible with newer versions of Django.
Review Request #9416 — Created Dec. 2, 2017 and submitted
never_cache_patterns()is an old function of ours that applies
@never_cachedecorator to a list of URLs. It was built to
patterns(), which doesn't exist in modern versions of
Django, and assumed older URL semantics like the ability to associate
URLs with view lookup strings, which also doesn't exist anymore.
This updates the function to be more future-proof. It no longer requires
a prefix string as the first parameter, and in fact warns if a string
that is non-empty is provided, outright failing if provided on Django
1.10 or higher (which doesn't include prefix support).
Unit tests were added to test the function with and without prefix
strings, in a way that ensures things work properly on whatever version
of Django is being tested against.
Unit tests pass on Django 1.6, 1.9, 1.10, 1.11. Opting not to bother
with older versions at this stage.
- Fixed a blank line.
- Fixed unused variables.
- Added the rest of a missing test that didn't make it through
Revision 2 (+125 -9)
Checks run (2 succeeded)