|
Revision 23252, 0.9 KB
(checked in by exarkun, 2 years ago)
|
|
Merge twistd-non-deprecation-3127-2
Author: exarkun
Reviewer: therve
Fixes #3127
Promote the PendingDeprecationWarning in twisted.scripts.mktap to a
DeprecationWarning. Change twisted.scripts._twistd_unix so that it
does not import twisted.scripts.mktap (triggering the deprecation),
and change the tap plugin definitions to use a new, public API for
creating IServiceMaker plugins instead of using the private API from
twisted.scripts.mktap.
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | from zope.interface import implements |
|---|
| 5 | |
|---|
| 6 | from twisted.plugin import IPlugin |
|---|
| 7 | from twisted.web2.iweb import IResource |
|---|
| 8 | |
|---|
| 9 | class _Web2ResourcePlugin(object): |
|---|
| 10 | implements(IPlugin, IResource) |
|---|
| 11 | |
|---|
| 12 | def __init__(self, name, className, description): |
|---|
| 13 | self.name = name |
|---|
| 14 | self.className = className |
|---|
| 15 | self.description = description |
|---|
| 16 | |
|---|
| 17 | TestResource = _Web2ResourcePlugin("TestResource", |
|---|
| 18 | "twisted.web2.plugin.TestResource", |
|---|
| 19 | "I'm a test resource") |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | from twisted.application.service import ServiceMaker |
|---|
| 23 | |
|---|
| 24 | TwistedWeb2 = ServiceMaker('Twisted Web2', |
|---|
| 25 | 'twisted.web2.tap', |
|---|
| 26 | ("An HTTP/1.1 web server that can serve from a " |
|---|
| 27 | "filesystem or application resource."), |
|---|
| 28 | "web2") |
|---|