Ignore:
Timestamp:
Jan 22, 2012, 2:51:25 PM (9 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Message:

Cleanups leading up to Wokkel 0.7.0.

As we now depend on Twisted 10.0.0 or higher, the following classes and
interfaces were deprecated:

This also resolves all Pyflakes warnings, changes links for www.xmpp.org to
xmpp.org and fixes the copyright notice in LICENSE to include 2012.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/subprotocols.py

    r101 r165  
    88"""
    99
     10__all__ = ['XMPPHandler', 'XMPPHandlerCollection', 'StreamManager',
     11           'IQHandlerMixin']
     12
    1013from zope.interface import implements
    1114
     
    1316from twisted.internet.error import ConnectionDone
    1417from twisted.python import failure, log
    15 from twisted.words.protocols.jabber import error, xmlstream
     18from twisted.python.deprecate import deprecatedModuleAttribute
     19from twisted.python.versions import Version
     20from twisted.words.protocols.jabber import error, ijabber, xmlstream
    1621from twisted.words.protocols.jabber.xmlstream import toResponse
     22from twisted.words.protocols.jabber.xmlstream import XMPPHandlerCollection
    1723from twisted.words.xish import xpath
    1824from twisted.words.xish.domish import IElement
    1925
    20 from wokkel.iwokkel import IXMPPHandler, IXMPPHandlerCollection
     26deprecatedModuleAttribute(
     27        Version("Wokkel", 0, 7, 0),
     28        "Use twisted.words.protocols.jabber.xmlstream.XMPPHandlerCollection "
     29                "instead.",
     30        __name__,
     31        "XMPPHandlerCollection")
    2132
    2233class XMPPHandler(object):
     
    2839    """
    2940
    30     implements(IXMPPHandler)
     41    implements(ijabber.IXMPPHandler)
    3142
    3243    def __init__(self):
     
    105116        """
    106117        return self.parent.request(request)
    107 
    108 
    109 
    110 class XMPPHandlerCollection(object):
    111     """
    112     Collection of XMPP subprotocol handlers.
    113 
    114     This allows for grouping of subprotocol handlers, but is not an
    115     L{XMPPHandler} itself, so this is not recursive.
    116 
    117     @ivar handlers: List of protocol handlers.
    118     @type handlers: L{list} of objects providing
    119                       L{IXMPPHandler}
    120     """
    121 
    122     implements(IXMPPHandlerCollection)
    123 
    124     def __init__(self):
    125         self.handlers = []
    126 
    127 
    128     def __iter__(self):
    129         """
    130         Act as a container for handlers.
    131         """
    132         return iter(self.handlers)
    133 
    134 
    135     def addHandler(self, handler):
    136         """
    137         Add protocol handler.
    138 
    139         Protocol handlers are expected to provide L{IXMPPHandler}.
    140         """
    141         self.handlers.append(handler)
    142 
    143 
    144     def removeHandler(self, handler):
    145         """
    146         Remove protocol handler.
    147         """
    148         self.handlers.remove(handler)
    149118
    150119
     
    476445
    477446        def fromStanzaError(failure, iq):
    478             e = failure.trap(error.StanzaError)
     447            failure.trap(error.StanzaError)
    479448            return failure.value.toResponse(iq)
    480449
Note: See TracChangeset for help on using the changeset viewer.