Ticket #3035 (closed enhancement: fixed)

Opened 3 years ago

Last modified 19 months ago

deprecated Resource subclasses in twisted.web.error, add equivalents in twisted.web.resource

Reported by: exarkun Owned by: exarkun
Priority: normal Milestone:
Component: web Keywords:
Cc: Branch: branches/deprecate-error-pages-3035
Author: exarkun Launchpad Bug:

Description

This circularity is dumb and it breaks tools (eg pydoctor).

Generally, error modules are for exceptions, anyway.

Change History

  Changed 20 months ago by exarkun

  • status changed from new to assigned
  • owner changed from jknight to exarkun

  Changed 20 months ago by exarkun

  • branch set to branches/deprecate-error-pages-3035
  • branch_author set to exarkun

(In [26020]) Branching to 'deprecate-error-pages-3035'

  Changed 20 months ago by exarkun

  • keywords review added
  • status changed from assigned to new
  • owner exarkun deleted

Done, please review.

follow-up: ↓ 5   Changed 20 months ago by glyph

  • owner set to exarkun
  • keywords review removed
  1. A number of tests emit the new warnings, such as:
    /home/glyph/Projects/Twisted/trunk/twisted/web/_auth/wrapper.py:120: DeprecationWarning: twisted.web.error.ErrorPage is deprecated since Twisted 9.0.  See twisted.web.resource.ErrorPage.
    
  2. The moved resources should get docstrings.

in reply to: ↑ 4   Changed 20 months ago by exarkun

  • keywords review added

Replying to glyph:

1. A number of tests emit the new warnings, such as: {{{ /home/glyph/Projects/Twisted/trunk/twisted/web/_auth/wrapper.py:120: DeprecationWarning: twisted.web.error.ErrorPage is deprecated since Twisted 9.0. See twisted.web.resource.ErrorPage. }}}

Okay, I think I replaced all uses of the deprecated API with the non-deprecated API. Running the test suite like this:

PYTHONPATH= python -W 'error:twisted.web.error.ErrorPage is deprecated since Twisted 9.0.  See twisted.web.resource.ErrorPage.' -W 'error:twisted.web.error.NoResource is deprecated since Twisted 9.0.  See twisted.web.resource.NoResource.' -W 'error:twisted.web.error.ForbiddenResource is deprecated since Twisted 9.0.  See twisted.web.resource.ForbiddenResource.' ~/Projects/Twisted/branches/deprecate-error-pages-3035/bin/trial twisted

now produces no errors for me. I had to change a bunch of code with no unit tests, so I added some. I did not add tests for the Quixote stuff. Changes in r26031.

1. The moved resources should get docstrings.

Fixed in r26029.

  Changed 20 months ago by exarkun

  • owner exarkun deleted

  Changed 20 months ago by therve

  • owner set to exarkun
  • keywords review removed
  • Some flakes:
    twisted/web/test/test_cgi.py:7: 'static' imported but unused
    twisted/web/test/test_vhost.py:11: 'Resource' imported but unused
    twisted/web/twcgi.py:24: 'html' imported but unused
    
  • The new deprecation warnings are missing tests.

  Changed 20 months ago by therve

  • owner changed from exarkun to therve
  • keywords review added

  Changed 20 months ago by therve

  • keywords review removed
  • owner changed from therve to exarkun

OK I missed some files :). +1.

  Changed 20 months ago by exarkun

(In [26112]) remove unused imports; replace relative imports with absolute imports; update copyrights; add/reformat module docstrings

refs #3035

  Changed 20 months ago by exarkun

(In [26114]) work around pydoctor bug; markup cannot span multiple lines :/

refs #3035

  Changed 19 months ago by exarkun

(In [26115]) Skip 403 test on Windows

refs #3035

  Changed 19 months ago by exarkun

Buildbot revealed some minor issues. I responded to review feedback and fixed the build issues in the revisions above. Merging now.

  Changed 19 months ago by exarkun

  • status changed from new to closed
  • resolution set to fixed

(In [26116]) Merge deprecate-error-pages-3035

Author: exarkun Reviewer: glyph, therve Fixes: #3035

Move the error response resource classes from twisted.web.error to twisted.web.resource. This is the first step in eliminating the circular dependency between those two modules. Deprecated versions of the resources remain in twisted.web.error for backwards compatibility and numerous tests for these classes have been added.

Note: See TracTickets for help on using tickets.