Fix generating AJAX caching serials on modern Django projects.

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

chipx86
Djblets
release-2.0.x
djblets

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
Fix generating AJAX caching serials on modern Django projects.
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (26c409d)
Loading...