| 1 | Index: twisted/web/__init__.py |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- twisted/web/__init__.py (révision 32445) |
|---|
| 4 | +++ twisted/web/__init__.py (copie de travail) |
|---|
| 5 | @@ -10,4 +10,11 @@ |
|---|
| 6 | """ |
|---|
| 7 | |
|---|
| 8 | from twisted.web._version import version |
|---|
| 9 | +from twisted.python.versions import Version |
|---|
| 10 | +from twisted.python.deprecate import deprecatedModuleAttribute |
|---|
| 11 | __version__ = version.short() |
|---|
| 12 | + |
|---|
| 13 | +deprecatedModuleAttribute( |
|---|
| 14 | + Version('Twisted', 11, 1, 0), |
|---|
| 15 | + "Google module is deprecated. Use Google's API instead", |
|---|
| 16 | + __name__, "google") |
|---|
| 17 | Index: twisted/web/test/test_web.py |
|---|
| 18 | =================================================================== |
|---|
| 19 | --- twisted/web/test/test_web.py (révision 32445) |
|---|
| 20 | +++ twisted/web/test/test_web.py (copie de travail) |
|---|
| 21 | @@ -597,6 +597,14 @@ |
|---|
| 22 | return d |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | + def test_deprecated(self): |
|---|
| 26 | + """ |
|---|
| 27 | + Google module is deprecated since Twisted 11.1.0 |
|---|
| 28 | + """ |
|---|
| 29 | + from twisted.web import google |
|---|
| 30 | + warnings = self.flushWarnings(offendingFunctions=[self.test_deprecated]) |
|---|
| 31 | + self.assertEqual(len(warnings),1) |
|---|
| 32 | + self.assertEqual(warnings[0]['category'], DeprecationWarning) |
|---|
| 33 | Index: twisted/web/google.py |
|---|
| 34 | =================================================================== |
|---|
| 35 | --- twisted/web/google.py (révision 32445) |
|---|
| 36 | +++ twisted/web/google.py (copie de travail) |
|---|
| 37 | @@ -7,6 +7,9 @@ |
|---|
| 38 | import urllib |
|---|
| 39 | from twisted.internet import protocol, reactor, defer |
|---|
| 40 | from twisted.web import http |
|---|
| 41 | +from twisted.python.deprecate import deprecated |
|---|
| 42 | +from twisted.python.versions import Version, getVersionString |
|---|
| 43 | +import warnings |
|---|
| 44 | |
|---|
| 45 | class GoogleChecker(http.HTTPClient): |
|---|