Skip to content

Commit

Permalink
Remove a long-deprecated API.
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonspeed committed May 2, 2024
1 parent ac924d9 commit 3ddf5c8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 68 deletions.
21 changes: 0 additions & 21 deletions src/twisted/web/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@

from zope.interface import implementer

from incremental import Version

from twisted import copyright
from twisted.internet import address, interfaces
from twisted.internet.error import AlreadyCalled, AlreadyCancelled
from twisted.logger import Logger
from twisted.python import components, failure, reflect
from twisted.python.compat import nativeString, networkString
from twisted.python.deprecate import deprecated
from twisted.spread.pb import Copyable, ViewPoint
from twisted.web import http, iweb, resource, util
from twisted.web.error import UnsupportedMethod
Expand All @@ -51,24 +48,6 @@
"GzipEncoderFactory",
]


# backwards compatibility
@deprecated(
Version("Twisted", 12, 1, 0),
"twisted.web.http.datetimeToString",
)
def date_time_string(dt):
return http.datetimeToString(dt)


@deprecated(
Version("Twisted", 12, 1, 0),
"twisted.web.http.stringToDatetime",
)
def string_date_time(dts):
return http.stringToDatetime(dts)


# Support for other methods may be implemented on a per-resource basis.
supportedMethods = (b"GET", b"HEAD", b"POST")

Expand Down
47 changes: 0 additions & 47 deletions src/twisted/web/test/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -1783,53 +1783,6 @@ def test_userAgentQuote(self):
)


class ServerAttributesTests(unittest.TestCase):
"""
Tests that deprecated twisted.web.server attributes raise the appropriate
deprecation warnings when used.
"""

def test_deprecatedAttributeDateTimeString(self):
"""
twisted.web.server.date_time_string should not be used; instead use
twisted.web.http.datetimeToString directly
"""
server.date_time_string(10)
warnings = self.flushWarnings(
offendingFunctions=[self.test_deprecatedAttributeDateTimeString]
)

self.assertEqual(len(warnings), 1)
self.assertEqual(warnings[0]["category"], DeprecationWarning)
self.assertEqual(
warnings[0]["message"],
(
"twisted.web.server.date_time_string was deprecated in Twisted "
"12.1.0; please use twisted.web.http.datetimeToString instead"
),
)

def test_deprecatedAttributeStringDateTime(self):
"""
twisted.web.server.string_date_time should not be used; instead use
twisted.web.http.stringToDatetime directly
"""
server.string_date_time(b"Thursday, 29-Sep-16 17:15:29 GMT")
warnings = self.flushWarnings(
offendingFunctions=[self.test_deprecatedAttributeStringDateTime]
)

self.assertEqual(len(warnings), 1)
self.assertEqual(warnings[0]["category"], DeprecationWarning)
self.assertEqual(
warnings[0]["message"],
(
"twisted.web.server.string_date_time was deprecated in Twisted "
"12.1.0; please use twisted.web.http.stringToDatetime instead"
),
)


class ExplicitHTTPFactoryReactor(unittest.TestCase):
"""
L{http.HTTPFactory} accepts explicit reactor selection.
Expand Down

0 comments on commit 3ddf5c8

Please sign in to comment.