Changeset 63:b8139f79276f for wokkel/compat.py
- Timestamp:
- Jul 6, 2009, 9:26:47 AM (12 years ago)
- Branch:
- default
- Convert:
- svn:b33ecbfc-034c-dc11-8662-000475d9059e/trunk@175
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wokkel/compat.py
r53 r63 1 1 # -*- test-case-name: wokkel.test.test_compat -*- 2 2 # 3 # Copyright (c) 2001-200 8Twisted Matrix Laboratories.3 # Copyright (c) 2001-2009 Twisted Matrix Laboratories. 4 4 # See LICENSE for details. 5 5 6 6 from twisted.internet import protocol 7 7 from twisted.words.protocols.jabber import xmlstream 8 from twisted.words.xish import domish9 8 10 9 class BootstrapMixin(object): … … 95 94 self.installBootstraps(xs) 96 95 return xs 96 97 98 99 class IQ(xmlstream.IQ): 100 def __init__(self, *args, **kwargs): 101 # Make sure we have a reactor parameter 102 try: 103 reactor = kwargs['reactor'] 104 except KeyError: 105 from twisted.internet import reactor 106 kwargs['reactor'] = reactor 107 108 # Check if IQ's init accepts the reactor parameter 109 try: 110 xmlstream.IQ.__init__(self, *args, **kwargs) 111 except TypeError: 112 # Guess not. Remove the reactor parameter and try again. 113 del kwargs['reactor'] 114 xmlstream.IQ.__init__(self, *args, **kwargs) 115 116 # Patch the XmlStream instance so that it has a _callLater 117 self._xmlstream._callLater = reactor.callLater
Note: See TracChangeset
for help on using the changeset viewer.