[47] | 1 | # HG changeset patch |
---|
| 2 | # Parent ebdb7afc619efdbb2a6ec82470a7e635634efbad |
---|
| 3 | |
---|
| 4 | diff -r ebdb7afc619e wokkel/disco.py |
---|
| 5 | --- a/wokkel/disco.py Sun Feb 20 16:25:18 2011 +0100 |
---|
| 6 | +++ b/wokkel/disco.py Sun Feb 20 16:28:57 2011 +0100 |
---|
| 7 | @@ -12,12 +12,13 @@ |
---|
| 8 | |
---|
| 9 | from twisted.internet import defer |
---|
| 10 | from twisted.words.protocols.jabber import error, jid |
---|
| 11 | +from twisted.words.protocols.jabber.xmlstream import XMPPHandler |
---|
| 12 | from twisted.words.xish import domish |
---|
| 13 | |
---|
| 14 | from wokkel import data_form |
---|
| 15 | from wokkel.compat import IQ |
---|
| 16 | from wokkel.iwokkel import IDisco |
---|
| 17 | -from wokkel.subprotocols import IQHandlerMixin, XMPPHandler |
---|
| 18 | +from wokkel.subprotocols import IQHandlerMixin |
---|
| 19 | |
---|
| 20 | NS_DISCO = 'http://jabber.org/protocol/disco' |
---|
| 21 | NS_DISCO_INFO = NS_DISCO + '#info' |
---|
| 22 | diff -r ebdb7afc619e wokkel/generic.py |
---|
| 23 | --- a/wokkel/generic.py Sun Feb 20 16:25:18 2011 +0100 |
---|
| 24 | +++ b/wokkel/generic.py Sun Feb 20 16:28:57 2011 +0100 |
---|
| 25 | @@ -22,7 +22,6 @@ |
---|
| 26 | |
---|
| 27 | from wokkel import disco |
---|
| 28 | from wokkel.iwokkel import IDisco |
---|
| 29 | -from wokkel.subprotocols import XMPPHandler |
---|
| 30 | |
---|
| 31 | IQ_GET = '/iq[@type="get"]' |
---|
| 32 | IQ_SET = '/iq[@type="set"]' |
---|
| 33 | @@ -68,7 +67,7 @@ |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | -class FallbackHandler(XMPPHandler): |
---|
| 38 | +class FallbackHandler(xmlstream.XMPPHandler): |
---|
| 39 | """ |
---|
| 40 | XMPP subprotocol handler that catches unhandled iq requests. |
---|
| 41 | |
---|
| 42 | @@ -89,7 +88,7 @@ |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | -class VersionHandler(XMPPHandler): |
---|
| 47 | +class VersionHandler(xmlstream.XMPPHandler): |
---|
| 48 | """ |
---|
| 49 | XMPP subprotocol handler for XMPP Software Version. |
---|
| 50 | |
---|
| 51 | diff -r ebdb7afc619e wokkel/iwokkel.py |
---|
| 52 | --- a/wokkel/iwokkel.py Sun Feb 20 16:25:18 2011 +0100 |
---|
| 53 | +++ b/wokkel/iwokkel.py Sun Feb 20 16:28:57 2011 +0100 |
---|
| 54 | @@ -5,110 +5,7 @@ |
---|
| 55 | Wokkel interfaces. |
---|
| 56 | """ |
---|
| 57 | |
---|
| 58 | -from zope.interface import Attribute, Interface |
---|
| 59 | - |
---|
| 60 | -class IXMPPHandler(Interface): |
---|
| 61 | - """ |
---|
| 62 | - Interface for XMPP protocol handlers. |
---|
| 63 | - |
---|
| 64 | - Objects that provide this interface can be added to a stream manager to |
---|
| 65 | - handle of (part of) an XMPP extension protocol. |
---|
| 66 | - """ |
---|
| 67 | - |
---|
| 68 | - parent = Attribute("""XML stream manager for this handler""") |
---|
| 69 | - xmlstream = Attribute("""The managed XML stream""") |
---|
| 70 | - |
---|
| 71 | - def setHandlerParent(parent): |
---|
| 72 | - """ |
---|
| 73 | - Set the parent of the handler. |
---|
| 74 | - |
---|
| 75 | - @type parent: L{IXMPPHandlerCollection} |
---|
| 76 | - """ |
---|
| 77 | - |
---|
| 78 | - |
---|
| 79 | - def disownHandlerParent(parent): |
---|
| 80 | - """ |
---|
| 81 | - Remove the parent of the handler. |
---|
| 82 | - |
---|
| 83 | - @type parent: L{IXMPPHandlerCollection} |
---|
| 84 | - """ |
---|
| 85 | - |
---|
| 86 | - |
---|
| 87 | - def makeConnection(xs): |
---|
| 88 | - """ |
---|
| 89 | - A connection over the underlying transport of the XML stream has been |
---|
| 90 | - established. |
---|
| 91 | - |
---|
| 92 | - At this point, no traffic has been exchanged over the XML stream |
---|
| 93 | - given in C{xs}. |
---|
| 94 | - |
---|
| 95 | - This should setup L{xmlstream} and call L{connectionMade}. |
---|
| 96 | - |
---|
| 97 | - @type xs: L{XmlStream<twisted.words.protocols.jabber.XmlStream>} |
---|
| 98 | - """ |
---|
| 99 | - |
---|
| 100 | - |
---|
| 101 | - def connectionMade(): |
---|
| 102 | - """ |
---|
| 103 | - Called after a connection has been established. |
---|
| 104 | - |
---|
| 105 | - This method can be used to change properties of the XML Stream, its |
---|
| 106 | - authenticator or the stream manager prior to stream initialization |
---|
| 107 | - (including authentication). |
---|
| 108 | - """ |
---|
| 109 | - |
---|
| 110 | - |
---|
| 111 | - def connectionInitialized(): |
---|
| 112 | - """ |
---|
| 113 | - The XML stream has been initialized. |
---|
| 114 | - |
---|
| 115 | - At this point, authentication was successful, and XML stanzas can be |
---|
| 116 | - exchanged over the XML stream L{xmlstream}. This method can be |
---|
| 117 | - used to setup observers for incoming stanzas. |
---|
| 118 | - """ |
---|
| 119 | - |
---|
| 120 | - |
---|
| 121 | - def connectionLost(reason): |
---|
| 122 | - """ |
---|
| 123 | - The XML stream has been closed. |
---|
| 124 | - |
---|
| 125 | - Subsequent use of L{parent.send} will result in data being queued |
---|
| 126 | - until a new connection has been established. |
---|
| 127 | - |
---|
| 128 | - @type reason: L{twisted.python.failure.Failure} |
---|
| 129 | - """ |
---|
| 130 | - |
---|
| 131 | - |
---|
| 132 | - |
---|
| 133 | -class IXMPPHandlerCollection(Interface): |
---|
| 134 | - """ |
---|
| 135 | - Collection of handlers. |
---|
| 136 | - |
---|
| 137 | - Contain several handlers and manage their connection. |
---|
| 138 | - """ |
---|
| 139 | - |
---|
| 140 | - def __iter__(): |
---|
| 141 | - """ |
---|
| 142 | - Get an iterator over all child handlers. |
---|
| 143 | - """ |
---|
| 144 | - |
---|
| 145 | - |
---|
| 146 | - def addHandler(handler): |
---|
| 147 | - """ |
---|
| 148 | - Add a child handler. |
---|
| 149 | - |
---|
| 150 | - @type handler: L{IXMPPHandler} |
---|
| 151 | - """ |
---|
| 152 | - |
---|
| 153 | - |
---|
| 154 | - def removeHandler(handler): |
---|
| 155 | - """ |
---|
| 156 | - Remove a child handler. |
---|
| 157 | - |
---|
| 158 | - @type handler: L{IXMPPHandler} |
---|
| 159 | - """ |
---|
| 160 | - |
---|
| 161 | - |
---|
| 162 | +from zope.interface import Interface |
---|
| 163 | |
---|
| 164 | class IDisco(Interface): |
---|
| 165 | """ |
---|
| 166 | diff -r ebdb7afc619e wokkel/ping.py |
---|
| 167 | --- a/wokkel/ping.py Sun Feb 20 16:25:18 2011 +0100 |
---|
| 168 | +++ b/wokkel/ping.py Sun Feb 20 16:28:57 2011 +0100 |
---|
| 169 | @@ -14,11 +14,7 @@ |
---|
| 170 | |
---|
| 171 | from twisted.words.protocols.jabber.error import StanzaError |
---|
| 172 | from twisted.words.protocols.jabber.xmlstream import IQ, toResponse |
---|
| 173 | - |
---|
| 174 | -try: |
---|
| 175 | - from twisted.words.protocols.xmlstream import XMPPHandler |
---|
| 176 | -except ImportError: |
---|
| 177 | - from wokkel.subprotocols import XMPPHandler |
---|
| 178 | +from twisted.words.protocols.jabber.xmlstream import XMPPHandler |
---|
| 179 | |
---|
| 180 | from wokkel import disco, iwokkel |
---|
| 181 | |
---|
| 182 | diff -r ebdb7afc619e wokkel/pubsub.py |
---|
| 183 | --- a/wokkel/pubsub.py Sun Feb 20 16:25:18 2011 +0100 |
---|
| 184 | +++ b/wokkel/pubsub.py Sun Feb 20 16:28:57 2011 +0100 |
---|
| 185 | @@ -15,11 +15,12 @@ |
---|
| 186 | from twisted.internet import defer |
---|
| 187 | from twisted.python import log |
---|
| 188 | from twisted.words.protocols.jabber import jid, error |
---|
| 189 | +from twisted.words.protocols.jabber.xmlstream import XMPPHandler |
---|
| 190 | from twisted.words.xish import domish |
---|
| 191 | |
---|
| 192 | from wokkel import disco, data_form, generic, shim |
---|
| 193 | from wokkel.compat import IQ |
---|
| 194 | -from wokkel.subprotocols import IQHandlerMixin, XMPPHandler |
---|
| 195 | +from wokkel.subprotocols import IQHandlerMixin |
---|
| 196 | from wokkel.iwokkel import IPubSubClient, IPubSubService, IPubSubResource |
---|
| 197 | |
---|
| 198 | # Iq get and set XPath queries |
---|
| 199 | diff -r ebdb7afc619e wokkel/subprotocols.py |
---|
| 200 | --- a/wokkel/subprotocols.py Sun Feb 20 16:25:18 2011 +0100 |
---|
| 201 | +++ b/wokkel/subprotocols.py Sun Feb 20 16:28:57 2011 +0100 |
---|
| 202 | @@ -7,134 +7,29 @@ |
---|
| 203 | XMPP subprotocol support. |
---|
| 204 | """ |
---|
| 205 | |
---|
| 206 | -from zope.interface import implements |
---|
| 207 | - |
---|
| 208 | from twisted.internet import defer |
---|
| 209 | -from twisted.python import log |
---|
| 210 | +from twisted.python import deprecate, log, versions |
---|
| 211 | from twisted.words.protocols.jabber import error, xmlstream |
---|
| 212 | from twisted.words.protocols.jabber.xmlstream import toResponse |
---|
| 213 | +from twisted.words.protocols.jabber.xmlstream import XMPPHandler |
---|
| 214 | +from twisted.words.protocols.jabber.xmlstream import XMPPHandlerCollection |
---|
| 215 | from twisted.words.xish import xpath |
---|
| 216 | from twisted.words.xish.domish import IElement |
---|
| 217 | |
---|
| 218 | -from wokkel.iwokkel import IXMPPHandler, IXMPPHandlerCollection |
---|
| 219 | +_deprecatedVersion = versions.Version("wokkel", 0, 7, 0) |
---|
| 220 | |
---|
| 221 | -class XMPPHandler(object): |
---|
| 222 | - """ |
---|
| 223 | - XMPP protocol handler. |
---|
| 224 | +deprecate.deprecatedModuleAttribute( |
---|
| 225 | + _deprecatedVersion, |
---|
| 226 | + "use twisted.words.protocols.jabber.xmlstream.XMPPHandler instead.", |
---|
| 227 | + __name__, |
---|
| 228 | + 'XMPPHandler') |
---|
| 229 | |
---|
| 230 | - Classes derived from this class implement (part of) one or more XMPP |
---|
| 231 | - extension protocols, and are referred to as a subprotocol implementation. |
---|
| 232 | - """ |
---|
| 233 | - |
---|
| 234 | - implements(IXMPPHandler) |
---|
| 235 | - |
---|
| 236 | - def __init__(self): |
---|
| 237 | - self.parent = None |
---|
| 238 | - self.xmlstream = None |
---|
| 239 | - |
---|
| 240 | - |
---|
| 241 | - def setHandlerParent(self, parent): |
---|
| 242 | - self.parent = parent |
---|
| 243 | - self.parent.addHandler(self) |
---|
| 244 | - |
---|
| 245 | - |
---|
| 246 | - def disownHandlerParent(self, parent): |
---|
| 247 | - self.parent.removeHandler(self) |
---|
| 248 | - self.parent = None |
---|
| 249 | - |
---|
| 250 | - |
---|
| 251 | - def makeConnection(self, xs): |
---|
| 252 | - self.xmlstream = xs |
---|
| 253 | - self.connectionMade() |
---|
| 254 | - |
---|
| 255 | - |
---|
| 256 | - def connectionMade(self): |
---|
| 257 | - """ |
---|
| 258 | - Called after a connection has been established. |
---|
| 259 | - |
---|
| 260 | - Can be overridden to perform work before stream initialization. |
---|
| 261 | - """ |
---|
| 262 | - |
---|
| 263 | - |
---|
| 264 | - def connectionInitialized(self): |
---|
| 265 | - """ |
---|
| 266 | - The XML stream has been initialized. |
---|
| 267 | - |
---|
| 268 | - Can be overridden to perform work after stream initialization, e.g. to |
---|
| 269 | - set up observers and start exchanging XML stanzas. |
---|
| 270 | - """ |
---|
| 271 | - |
---|
| 272 | - |
---|
| 273 | - def connectionLost(self, reason): |
---|
| 274 | - """ |
---|
| 275 | - The XML stream has been closed. |
---|
| 276 | - |
---|
| 277 | - This method can be extended to inspect the C{reason} argument and |
---|
| 278 | - act on it. |
---|
| 279 | - """ |
---|
| 280 | - self.xmlstream = None |
---|
| 281 | - |
---|
| 282 | - |
---|
| 283 | - def send(self, obj): |
---|
| 284 | - """ |
---|
| 285 | - Send data over the managed XML stream. |
---|
| 286 | - |
---|
| 287 | - @note: The stream manager maintains a queue for data sent using this |
---|
| 288 | - method when there is no current initialized XML stream. This |
---|
| 289 | - data is then sent as soon as a new stream has been established |
---|
| 290 | - and initialized. Subsequently, L{connectionInitialized} will be |
---|
| 291 | - called again. If this queueing is not desired, use C{send} on |
---|
| 292 | - C{self.xmlstream}. |
---|
| 293 | - |
---|
| 294 | - @param obj: data to be sent over the XML stream. This is usually an |
---|
| 295 | - object providing L{domish.IElement}, or serialized XML. See |
---|
| 296 | - L{xmlstream.XmlStream} for details. |
---|
| 297 | - """ |
---|
| 298 | - self.parent.send(obj) |
---|
| 299 | - |
---|
| 300 | - |
---|
| 301 | - |
---|
| 302 | -class XMPPHandlerCollection(object): |
---|
| 303 | - """ |
---|
| 304 | - Collection of XMPP subprotocol handlers. |
---|
| 305 | - |
---|
| 306 | - This allows for grouping of subprotocol handlers, but is not an |
---|
| 307 | - L{XMPPHandler} itself, so this is not recursive. |
---|
| 308 | - |
---|
| 309 | - @ivar handlers: List of protocol handlers. |
---|
| 310 | - @type handlers: L{list} of objects providing |
---|
| 311 | - L{IXMPPHandler} |
---|
| 312 | - """ |
---|
| 313 | - |
---|
| 314 | - implements(IXMPPHandlerCollection) |
---|
| 315 | - |
---|
| 316 | - def __init__(self): |
---|
| 317 | - self.handlers = [] |
---|
| 318 | - |
---|
| 319 | - |
---|
| 320 | - def __iter__(self): |
---|
| 321 | - """ |
---|
| 322 | - Act as a container for handlers. |
---|
| 323 | - """ |
---|
| 324 | - return iter(self.handlers) |
---|
| 325 | - |
---|
| 326 | - |
---|
| 327 | - def addHandler(self, handler): |
---|
| 328 | - """ |
---|
| 329 | - Add protocol handler. |
---|
| 330 | - |
---|
| 331 | - Protocol handlers are expected to provide L{IXMPPHandler}. |
---|
| 332 | - """ |
---|
| 333 | - self.handlers.append(handler) |
---|
| 334 | - |
---|
| 335 | - |
---|
| 336 | - def removeHandler(self, handler): |
---|
| 337 | - """ |
---|
| 338 | - Remove protocol handler. |
---|
| 339 | - """ |
---|
| 340 | - self.handlers.remove(handler) |
---|
| 341 | - |
---|
| 342 | - |
---|
| 343 | +deprecate.deprecatedModuleAttribute( |
---|
| 344 | + _deprecatedVersion, |
---|
| 345 | + "use twisted.words.protocols.jabber.xmlstream.XMPPHandlerCollection " |
---|
| 346 | + "instead.", |
---|
| 347 | + __name__, |
---|
| 348 | + 'XMPPHandlerCollection') |
---|
| 349 | |
---|
| 350 | class StreamManager(XMPPHandlerCollection): |
---|
| 351 | """ |
---|
| 352 | diff -r ebdb7afc619e wokkel/test/test_disco.py |
---|
| 353 | --- a/wokkel/test/test_disco.py Sun Feb 20 16:25:18 2011 +0100 |
---|
| 354 | +++ b/wokkel/test/test_disco.py Sun Feb 20 16:28:57 2011 +0100 |
---|
| 355 | @@ -11,12 +11,11 @@ |
---|
| 356 | from twisted.trial import unittest |
---|
| 357 | from twisted.words.protocols.jabber.error import StanzaError |
---|
| 358 | from twisted.words.protocols.jabber.jid import JID |
---|
| 359 | -from twisted.words.protocols.jabber.xmlstream import toResponse |
---|
| 360 | +from twisted.words.protocols.jabber.xmlstream import XMPPHandler, toResponse |
---|
| 361 | from twisted.words.xish import domish, utility |
---|
| 362 | |
---|
| 363 | from wokkel import data_form, disco |
---|
| 364 | from wokkel.generic import parseXml |
---|
| 365 | -from wokkel.subprotocols import XMPPHandler |
---|
| 366 | from wokkel.test.helpers import TestableRequestHandlerMixin, XmlStreamStub |
---|
| 367 | |
---|
| 368 | NS_DISCO_INFO = 'http://jabber.org/protocol/disco#info' |
---|
| 369 | diff -r ebdb7afc619e wokkel/test/test_subprotocols.py |
---|
| 370 | --- a/wokkel/test/test_subprotocols.py Sun Feb 20 16:25:18 2011 +0100 |
---|
| 371 | +++ b/wokkel/test/test_subprotocols.py Sun Feb 20 16:28:57 2011 +0100 |
---|
| 372 | @@ -5,15 +5,13 @@ |
---|
| 373 | Tests for L{wokkel.subprotocols} |
---|
| 374 | """ |
---|
| 375 | |
---|
| 376 | -from zope.interface.verify import verifyObject |
---|
| 377 | - |
---|
| 378 | from twisted.trial import unittest |
---|
| 379 | from twisted.test import proto_helpers |
---|
| 380 | from twisted.internet import defer |
---|
| 381 | from twisted.words.xish import domish |
---|
| 382 | from twisted.words.protocols.jabber import error, xmlstream |
---|
| 383 | |
---|
| 384 | -from wokkel import iwokkel, subprotocols |
---|
| 385 | +from wokkel import subprotocols |
---|
| 386 | |
---|
| 387 | class DummyFactory(object): |
---|
| 388 | """ |
---|
| 389 | @@ -28,7 +26,7 @@ |
---|
| 390 | |
---|
| 391 | |
---|
| 392 | |
---|
| 393 | -class DummyXMPPHandler(subprotocols.XMPPHandler): |
---|
| 394 | +class DummyXMPPHandler(xmlstream.XMPPHandler): |
---|
| 395 | """ |
---|
| 396 | Dummy XMPP subprotocol handler to count the methods are called on it. |
---|
| 397 | """ |
---|
| 398 | @@ -55,100 +53,6 @@ |
---|
| 399 | |
---|
| 400 | |
---|
| 401 | |
---|
| 402 | -class XMPPHandlerTest(unittest.TestCase): |
---|
| 403 | - """ |
---|
| 404 | - Tests for L{subprotocols.XMPPHandler}. |
---|
| 405 | - """ |
---|
| 406 | - |
---|
| 407 | - def test_interface(self): |
---|
| 408 | - """ |
---|
| 409 | - L{xmlstream.XMPPHandler} implements L{iwokkel.IXMPPHandler}. |
---|
| 410 | - """ |
---|
| 411 | - verifyObject(iwokkel.IXMPPHandler, subprotocols.XMPPHandler()) |
---|
| 412 | - |
---|
| 413 | - |
---|
| 414 | - def test_send(self): |
---|
| 415 | - """ |
---|
| 416 | - Test that data is passed on for sending by the stream manager. |
---|
| 417 | - """ |
---|
| 418 | - class DummyStreamManager(object): |
---|
| 419 | - def __init__(self): |
---|
| 420 | - self.outlist = [] |
---|
| 421 | - |
---|
| 422 | - def send(self, data): |
---|
| 423 | - self.outlist.append(data) |
---|
| 424 | - |
---|
| 425 | - handler = subprotocols.XMPPHandler() |
---|
| 426 | - handler.parent = DummyStreamManager() |
---|
| 427 | - handler.send('<presence/>') |
---|
| 428 | - self.assertEquals(['<presence/>'], handler.parent.outlist) |
---|
| 429 | - |
---|
| 430 | - |
---|
| 431 | - def test_makeConnection(self): |
---|
| 432 | - """ |
---|
| 433 | - Test that makeConnection saves the XML stream and calls connectionMade. |
---|
| 434 | - """ |
---|
| 435 | - class TestXMPPHandler(subprotocols.XMPPHandler): |
---|
| 436 | - def connectionMade(self): |
---|
| 437 | - self.doneMade = True |
---|
| 438 | - |
---|
| 439 | - handler = TestXMPPHandler() |
---|
| 440 | - xs = xmlstream.XmlStream(xmlstream.Authenticator()) |
---|
| 441 | - handler.makeConnection(xs) |
---|
| 442 | - self.assertTrue(handler.doneMade) |
---|
| 443 | - self.assertIdentical(xs, handler.xmlstream) |
---|
| 444 | - |
---|
| 445 | - |
---|
| 446 | - def test_connectionLost(self): |
---|
| 447 | - """ |
---|
| 448 | - Test that connectionLost forgets the XML stream. |
---|
| 449 | - """ |
---|
| 450 | - handler = subprotocols.XMPPHandler() |
---|
| 451 | - xs = xmlstream.XmlStream(xmlstream.Authenticator()) |
---|
| 452 | - handler.makeConnection(xs) |
---|
| 453 | - handler.connectionLost(Exception()) |
---|
| 454 | - self.assertIdentical(None, handler.xmlstream) |
---|
| 455 | - |
---|
| 456 | - |
---|
| 457 | - |
---|
| 458 | -class XMPPHandlerCollectionTest(unittest.TestCase): |
---|
| 459 | - """ |
---|
| 460 | - Tests for L{subprotocols.XMPPHandlerCollection}. |
---|
| 461 | - """ |
---|
| 462 | - |
---|
| 463 | - def setUp(self): |
---|
| 464 | - self.collection = subprotocols.XMPPHandlerCollection() |
---|
| 465 | - |
---|
| 466 | - |
---|
| 467 | - def test_interface(self): |
---|
| 468 | - """ |
---|
| 469 | - L{subprotocols.StreamManager} implements L{iwokkel.IXMPPHandlerCollection}. |
---|
| 470 | - """ |
---|
| 471 | - verifyObject(iwokkel.IXMPPHandlerCollection, self.collection) |
---|
| 472 | - |
---|
| 473 | - |
---|
| 474 | - def test_addHandler(self): |
---|
| 475 | - """ |
---|
| 476 | - Test the addition of a protocol handler. |
---|
| 477 | - """ |
---|
| 478 | - handler = DummyXMPPHandler() |
---|
| 479 | - handler.setHandlerParent(self.collection) |
---|
| 480 | - self.assertIn(handler, self.collection) |
---|
| 481 | - self.assertIdentical(self.collection, handler.parent) |
---|
| 482 | - |
---|
| 483 | - |
---|
| 484 | - def test_removeHandler(self): |
---|
| 485 | - """ |
---|
| 486 | - Test removal of a protocol handler. |
---|
| 487 | - """ |
---|
| 488 | - handler = DummyXMPPHandler() |
---|
| 489 | - handler.setHandlerParent(self.collection) |
---|
| 490 | - handler.disownHandlerParent(self.collection) |
---|
| 491 | - self.assertNotIn(handler, self.collection) |
---|
| 492 | - self.assertIdentical(None, handler.parent) |
---|
| 493 | - |
---|
| 494 | - |
---|
| 495 | - |
---|
| 496 | class StreamManagerTest(unittest.TestCase): |
---|
| 497 | """ |
---|
| 498 | Tests for L{subprotocols.StreamManager}. |
---|
| 499 | diff -r ebdb7afc619e wokkel/xmppim.py |
---|
| 500 | --- a/wokkel/xmppim.py Sun Feb 20 16:25:18 2011 +0100 |
---|
| 501 | +++ b/wokkel/xmppim.py Sun Feb 20 16:28:57 2011 +0100 |
---|
| 502 | @@ -13,11 +13,11 @@ |
---|
| 503 | """ |
---|
| 504 | |
---|
| 505 | from twisted.words.protocols.jabber.jid import JID |
---|
| 506 | +from twisted.words.protocols.jabber.xmlstream import XMPPHandler |
---|
| 507 | from twisted.words.xish import domish |
---|
| 508 | |
---|
| 509 | from wokkel.compat import IQ |
---|
| 510 | from wokkel.generic import ErrorStanza, Stanza |
---|
| 511 | -from wokkel.subprotocols import XMPPHandler |
---|
| 512 | |
---|
| 513 | NS_XML = 'http://www.w3.org/XML/1998/namespace' |
---|
| 514 | NS_ROSTER = 'jabber:iq:roster' |
---|