Ignore:
Timestamp:
Aug 3, 2011, 9:49:22 AM (9 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Message:

Add base class for IQ get/set request stanzas: Request.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/generic.py

    r96 r102  
    237237
    238238
     239class Request(Stanza):
     240    """
     241    IQ request stanza.
     242
     243    This is a base class for IQ get or set stanzas, to be used with
     244    L{wokkel.subprotocols.StreamManager.request}.
     245    """
     246
     247    stanzaKind = 'iq'
     248    stanzaType = 'get'
     249    timeout = None
     250
     251    def __init__(self, recipient=None, sender=None, stanzaType='get'):
     252        Stanza.__init__(self, recipient=recipient, sender=sender)
     253        self.stanzaType = stanzaType
     254
     255
     256    def toElement(self):
     257        element = Stanza.toElement(self)
     258
     259        if not self.stanzaID:
     260            element.addUniqueId()
     261            self.stanzaID = element['id']
     262
     263        return element
     264
     265
     266
    239267class DeferredXmlStreamFactory(BootstrapMixin, protocol.ClientFactory):
    240268    protocol = xmlstream.XmlStream
Note: See TracChangeset for help on using the changeset viewer.