Fix problems between the redirect URIs field and ListEditWidget in OAuth Application forms

Review Request #12347 — Created June 9, 2022 and submitted — Latest diff uploaded


Review Board


Recent updates to Djblet's ListEditWidget has caused Reviewboard's OAuth App
API to fail on POST and PUT requests because the OAuth App API wraps the OAuth
ApplicationChangeForm, which relies on the legacy behavior of the
ListEditWidget for its redirect_uris field. The legacy behavior of the
widget is to take in a string and split it into a list, as opposed to the modern
behavior of taking in a list. The redirect_uris field must be stored as a
string of space-separated URIs (this is required by
oauth2_provider.models.AbstractApplication). Usually the ListEditWidget and
corresponding ListEditField will take care of converting string inputs into
lists, but this does not happen properly in cases where the widget is not

This change makes the ApplicationChangeForm take care of converting the
redirect_uris field data into a list to ensure that the redirect_uris data
is properly passed to the widget's methods and saved to the form in cases
where the widget is not rendered.

  • Ran OAuth Unit tests.
  • Ran OAuth App API Unit tests.
  • Manually tested the OAuth Application form in the admin settings UI.