Mark proxy properties on scmtools.models.Tool as deprecated.

Review Request #12331 — Created June 3, 2022 and submitted

Information

Review Board
release-5.0.x

Reviewers

The Tool model has a handful of properties which proxy things which
are provided by the SCMTool subclass. This was used a long time ago to
make it easier to render things in templates (since trying to access the
class in the template would end up instantiating it). We haven't used
templates for this stuff in a long time, and all our code accesses these
via the scmtool_class property rather than these proxies.

This change adds a wrapper which will raise a deprecation warning if any
of these properties are accessed via the tool.

  • Opened a shell, enabled all warnings, and then accessed properties via
    the tool instance. Saw that I got the correct results, and that the
    deprecation warning was raised.
  • Ran unit tests.
Summary ID
Mark proxy properties on scmtools.models.Tool as deprecated.
The Tool model has a handful of properties which proxy things which are provided by the SCMTool subclass. This was used a long time ago to make it easier to render things in templates (since trying to access the class in the template would end up instantiating it). We haven't used templates for this stuff in a long time, and all our code accesses these via the `scmtool_class` property rather than these proxies. This change adds a wrapper which will raise a deprecation warning if any of these properties are accessed via the tool. Testing Done: - Opened a shell, enabled all warnings, and then accessed properties via the tool instance. Saw that I got the correct results, and that the deprecation warning was raised. - Ran unit tests.
2be21b1f7fefb87908fad246f7abe6d5947dc0ff
Description From Last Updated

I've landed my deprecation updates change, so this can go.

chipx86chipx86

Can you add a Version Added?

chipx86chipx86

We should probably use functools.wraps to ensure all the function attributes are set right.

chipx86chipx86

You don't need warnings anymore. You can just call RemovedInReviewBoard60Warning.warn(...) with the string.

chipx86chipx86
chipx86
  1. 
      
  2. reviewboard/deprecation.py (Diff revision 1)
     
     

    I've landed my deprecation updates change, so this can go.

  3. reviewboard/scmtools/models.py (Diff revision 1)
     
     
     
     
     
     
     

    Can you add a Version Added?

  4. reviewboard/scmtools/models.py (Diff revision 1)
     
     

    We should probably use functools.wraps to ensure all the function attributes are set right.

  5. reviewboard/scmtools/models.py (Diff revision 1)
     
     
     
     
     
     
     
     

    You don't need warnings anymore. You can just call RemovedInReviewBoard60Warning.warn(...) with the string.

  6. 
      
david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-5.0.x (eaa58b9)
Loading...