Fix generating AJAX caching serials on modern Django projects.

Review Request #11070 — Created July 6, 2020 and submitted

Information

Djblets
release-2.0.x

Reviewers

generate_ajax_serial() was still hard-coding a requirement for
settings.TEMPLATE_DIRS, which hasn't existed since Django 1.8.
Projects that wanted to use it needed to pull out the modern version of
this setting in order to get the function work.

Now, this function is compatible with both setups. It will
optimistically try to load from the modern TEMPLATES setting
(supporting any and all registered template engines) and falling back to
the old TEMPLATE_DIRS.

There's also a small tweak to this. If no template directories are
configured, it just sets the default serial of 0. It no longer walkes
the current directory, which is unlikely to ever be useful.

Unit tests pass.

Tested with Review Board with just a TEMPLATES setting.

Summary ID
Fix generating AJAX caching serials on modern Django projects.
`generate_ajax_serial()` was still hard-coding a requirement for `settings.TEMPLATE_DIRS`, which hasn't existed since Django 1.8. Projects that wanted to use it needed to pull out the modern version of this setting in order to get the function work. Now, this function is compatible with both setups. It will optimistically try to load from the modern `TEMPLATES` setting (supporting any and all registered template engines) and falling back to the old `TEMPLATE_DIRS`.
feb5f6cf018547c8b4aca4d0cad49e0d01d7fbdb
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (26c409d)