xmlcallback.py 1014 B

123456789101112131415161718192021222324252627282930313233343536
  1. """
  2. SleekXMPP: The Sleek XMPP Library
  3. Copyright (C) 2010 Nathanael C. Fritz
  4. This file is part of SleekXMPP.
  5. See the file LICENSE for copying permission.
  6. """
  7. from sleekxmpp.xmlstream.handler import Callback
  8. class XMLCallback(Callback):
  9. """
  10. The XMLCallback class is identical to the normal Callback class,
  11. except that XML contents of matched stanzas will be processed instead
  12. of the stanza objects themselves.
  13. Methods:
  14. run -- Overrides Callback.run
  15. """
  16. def run(self, payload, instream=False):
  17. """
  18. Execute the callback function with the matched stanza's
  19. XML contents, instead of the stanza itself.
  20. Overrides BaseHandler.run
  21. Arguments:
  22. payload -- The matched stanza object.
  23. instream -- Force the handler to execute during
  24. stream processing. Used only by prerun.
  25. Defaults to False.
  26. """
  27. Callback.run(self, payload.xml, instream)