root/trunk/twisted/plugins/twisted_web2.py

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# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
2# See LICENSE for details.
3
4from zope.interface import implements
5
6from twisted.plugin import IPlugin
7from twisted.web2.iweb import IResource
8
9class _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
17TestResource = _Web2ResourcePlugin("TestResource",
18                           "twisted.web2.plugin.TestResource",
19                           "I'm a test resource")
20
21
22from twisted.application.service import ServiceMaker
23
24TwistedWeb2 = 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")
Note: See TracBrowser for help on using the browser.