Changeset 41:72fa7b817767


Ignore:
Timestamp:
Oct 18, 2008, 12:40:56 PM (14 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Convert:
svn:b33ecbfc-034c-dc11-8662-000475d9059e/trunk@113
Message:

Compatibility fixes for Twisted 8.0 and 8.1.

Location:
wokkel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wokkel/component.py

    r40 r41  
    1515from twisted.words.xish import domish
    1616
     17try:
     18    #from twisted.words.protocols.jabber.xmlstream import XMPPHandler
     19    from twisted.words.protocols.jabber.xmlstream import XMPPHandlerCollection
     20except ImportError:
     21    #from wokkel.subprotocols import XMPPHandler
     22    from wokkel.subprotocols import XMPPHandlerCollection
     23
     24try:
     25    from twisted.words.protocols.jabber.xmlstream import XmlStreamServerFactory
     26except ImportError:
     27    from wokkel.compat import XmlStreamServerFactory
     28
    1729from wokkel.generic import XmlPipe
    1830from wokkel.subprotocols import StreamManager
     
    6779
    6880
    69 class InternalComponent(xmlstream.XMPPHandlerCollection, service.Service):
     81class InternalComponent(XMPPHandlerCollection, service.Service):
    7082    """
    7183    Component service that connects directly to a router.
     
    7789
    7890    def __init__(self, router, domain):
    79         xmlstream.XMPPHandlerCollection.__init__(self)
     91        XMPPHandlerCollection.__init__(self)
    8092        self.router = router
    8193        self.domain = domain
     
    116128        Add a new handler and connect it to the stream.
    117129        """
    118         xmlstream.XMPPHandlerCollection.addHandler(self, handler)
     130        XMPPHandlerCollection.addHandler(self, handler)
    119131
    120132        if self.xmlstream:
     
    169181        xmlstream.ListenAuthenticator.streamStarted(self, rootElement)
    170182
    171         # Compatibility fix
     183        # Compatibility fix for pre-8.2 implementations of ListenAuthenticator
    172184        if not self.xmlstream.sid:
    173185            from twisted.python import randbytes
     
    300312
    301313
    302 class XMPPComponentServerFactory(xmlstream.XmlStreamServerFactory):
     314class XMPPComponentServerFactory(XmlStreamServerFactory):
    303315    """
    304316    XMPP Component Server factory.
     
    318330            return ListenComponentAuthenticator(self.secret)
    319331
    320         xmlstream.XmlStreamServerFactory.__init__(self, authenticatorFactory)
     332        XmlStreamServerFactory.__init__(self, authenticatorFactory)
    321333        self.addBootstrap(xmlstream.STREAM_CONNECTED_EVENT,
    322334                          self.makeConnection)
  • wokkel/test/test_component.py

    r40 r41  
    1515from twisted.words.xish import domish
    1616
     17try:
     18    from twisted.words.protocols.jabber.ijabber import IXMPPHandlerCollection
     19    from twisted.words.protocols.jabber.xmlstream import XMPPHandler
     20except ImportError:
     21    from wokkel.subprotocols import IXMPPHandlerCollection, XMPPHandler
     22
    1723from wokkel import component
    1824from wokkel.generic import XmlPipe
     
    3137        """
    3238        L{component.InternalComponent} implements
    33         L{ijabber.IXMPPHandlerCollection}.
    34         """
    35         verifyObject(ijabber.IXMPPHandlerCollection, self.component)
     39        L{IXMPPHandlerCollection}.
     40        """
     41        verifyObject(IXMPPHandlerCollection, self.component)
    3642
    3743
     
    4349        events = []
    4450
    45         class TestHandler(xmlstream.XMPPHandler):
     51        class TestHandler(XMPPHandler):
    4652
    4753            def connectionInitialized(self):
     
    7076        events = []
    7177
    72         class TestHandler(xmlstream.XMPPHandler):
     78        class TestHandler(XMPPHandler):
    7379
    7480            def connectionLost(self, reason):
     
    9197        events = []
    9298
    93         class TestHandler(xmlstream.XMPPHandler):
     99        class TestHandler(XMPPHandler):
    94100
    95101            def connectionInitialized(self):
Note: See TracChangeset for help on using the changeset viewer.