Make never_cache_patterns() compatible with newer versions of Django.

Review Request #9416 — Created Dec. 2, 2017 and submitted

Information

Djblets
release-1.0.x
78af793...

Reviewers

never_cache_patterns() is an old function of ours that applies
Django's @never_cache decorator to a list of URLs. It was built to
work like 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.

Description From Last Updated

E303 too many blank lines (2)

reviewbotreviewbot

F841 local variable 'urlpatterns' is assigned to but never used

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-1.0.x (95f9cfc)
Loading...