Update the General Settings form to improve cache backend configuration.

Review Request #11066 — Created July 4, 2020 and submitted — Latest diff uploaded


Review Board


This change modernizes the General Settings page a bit, focusing on the
cache backend settings. We don't have pluggable cache backends, like we
do with many other parts of the product, so the General Settings page
has traditionally managed the settings for memcached, file-based cache,
and local memory cache in a pretty hard-coded way, and this didn't work
well with browser-side validation.

The cache backend configurations are now managed by their own forms, and
registered in a central place. This doesn't give us pluggable backends,
but it's a step toward allowing that in the future without having to
revisit all of this code.

This leaves the main form without all the hard-coded mappings and
constants, leaving all knowledge of explicit cache backends to the
registration dictionary. It also lets us use the new subform support to
manage the display and validation of the correct form for the selected
cache backend.

Since this is being changed anyway, some tweaks were made to help guide
users and prevent issues. The "Local Memory" cache backend is now only
enabled for development (non-PRODUCTION) installs, rather than being
keyed off by the DEBUG setting. This prevents it from showing up if an
install has been flipped to debug mode.

The option for the memcached backend now lists "(recommended)" after it,
giving users a hint that they should probably choose that rather than
the file cache backend.

There's also a tweak to a template location, to fix the path that's
referred to by Djblets for some of the fieldset rendering.

With all this, the General Settings page should now be complete and
operational for Review Board 4.0.

Tested loading and saving all of the cache backends in the General
Settings page, verifying the results in each case.