Update Review Bot extension for Django 1.11 changes.
Review Request #10877 — Created Feb. 3, 2020 and submitted — Latest diff uploaded
This change updates the Review Bot extension to handle deprecated and
changed APIs for Django 1.11 and Python 3. These include:
- URL patterns are now defined as lists instead of using the old
patterns
object. - Django used to ship a backport of Python 2.7's
import_module
, which
is no longer included. Since we are now 2.7+ only, we can use the
standard library version. ModelForm
needs to defineMeta.fields
.- Models need to define
app_label
, especially in the extension context
where the module is not listed inINSTALLED_APPS
. - The
ToolOptionsWidget.format_output
method was removed, seemingly
without explanation (despite being recommended as something that could
be overridden in the comments). Since we're completely overriding
the widget'srender
method, this has been changed to just do what
the oldformat_output
method did. - Python 3's
__import__
needs to use native strings rather than bytes.
Set up the Review Bot extension on my local devserver using the latest
Review Board release-4.0.x HEAD and Python 3, and connected a worker.
Configured an integration for jshint and published a review request. Saw
that Review Bot triggered the worker job, collected errors, and posted
them back to the review request.