• 
      

    Fix working with site directories containing custom commands.

    Review Request #11615 — Created May 24, 2021 and submitted — Latest diff uploaded

    Information

    Review Board
    release-4.0.x

    Reviewers

    Review Board 4.0 regressed working with site directories containing
    custom commands. There were two problems:

    1. The usage of exec() no longer worked, since we introduced a nested
      function within the same function calling that. Turns out this isn't
      legal in Python.

    2. Our method of injecting custom commands no longer worked.

    To fix this, we now have a new self-contained method responsible for
    grabbing the custom command. We then run it by using newer support for
    providing custom command classes to run (which does require that we
    create a specialized subclass of ManagementUtility).

    With this, we should have a more future-proof way of loading custom
    commands.

    Created a site directory with custom commands and reproduced the failure
    condition. Tested that the new code worked on Python 2.7 and 3.x.

    Verified that standard commands continued to work, and that both standard
    and custom commands also continued to show the correct help output.

    Commits

    Files