Changeset 22:9edffdf4aee4 for wokkel
- Timestamp:
- Jun 10, 2008, 8:12:33 PM (14 years ago)
- Branch:
- default
- Convert:
- svn:b33ecbfc-034c-dc11-8662-000475d9059e/trunk@52
- Location:
- wokkel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
wokkel/pubsub.py
r19 r22 390 390 handled as follows: 391 391 392 *If the exception is an instance of L{error.StanzaError}, an error393 response iq is returned.394 *Any other exception is reported using L{log.msg}. An error response395 with the condition C{internal-server-error} is returned.392 - If the exception is an instance of L{error.StanzaError}, an error 393 response iq is returned. 394 - Any other exception is reported using L{log.msg}. An error response 395 with the condition C{internal-server-error} is returned. 396 396 397 397 The default implementation of said methods raises an L{Unsupported} … … 402 402 @ivar pubSubFeatures: List of supported publish-subscribe features for 403 403 service discovery, as C{str}. 404 @type pubSubFeatures: C{list} or C{None} .404 @type pubSubFeatures: C{list} or C{None} 405 405 """ 406 406 -
wokkel/subprotocols.py
r8 r22 235 235 response of C{internal-server-error} to be sent. 236 236 237 A typical way to use this mixin, is to set up L{xpath} observers on the 238 C{xmlstream} to call handleRequest, for example in an overridden 239 L{XMPPHandler.connectionMade}. It is likely a good idea to only listen for 240 incoming iq get and/org iq set requests, and not for any iq, to prevent 241 hijacking incoming responses to outgoing iq requests. An example: 242 243 >>> QUERY_ROSTER = "/query[@xmlns='jabber:iq:roster']" 244 >>> class MyHandler(XMPPHandler, IQHandlerMixin): 245 ... iqHandlers = {"/iq[@type='get']" + QUERY_ROSTER: 'onRosterGet', 246 ... "/iq[@type='set']" + QUERY_ROSTER: 'onRosterSet'} 247 ... def connectionMade(self): 248 ... self.xmlstream.addObserver( 249 ... "/iq[@type='get' or @type='set']" + QUERY_ROSTER, 250 ... self.handleRequest) 251 ... def onRosterGet(self, iq): 252 ... pass 253 ... def onRosterSet(self, iq): 254 ... pass 255 237 256 @cvar iqHandlers: Mapping from XPath queries (as a string) to the method 238 257 name that will handle requests that match the query.
Note: See TracChangeset
for help on using the changeset viewer.