[PyXMPP] Adding content to stanza?

Winfried Tilanus winfried at tilanus.com
Wed Feb 21 03:33:00 CET 2007

Hi Jacek and others,

When I try to add a delay to a message stanza, I get an Error, but the
delay is correctly added to the stanza (see example below). Shouldn't
there be an 'elif' instead of a 'if' on line 301 of stanza.py?

Showcase (tested with rev. 646, but it doesn't seem to be changed lately):

>>> import datetime
>>> import pyxmpp.jabber.delay
>>> import pyxmpp.message

>>> m = pyxmpp.message.Message(to_jid='w at t')
>>> d = pyxmpp.jabber.delay.Delay(datetime.datetime.now(), "w at t")
>>> m.add_content(d)

Traceback (most recent call last):
  File "<pyshell#122>", line 1, in -toplevel-
  File "/usr/lib/python2.3/site-packages/pyxmpp/stanza.py", line 304, in
  File "/usr/lib/python2.3/site-packages/libxml2.py", line 2900, in
    libxml2mod.xmlNodeAddContent(self._o, content)
TypeError: xmlNodeAddContent() argument 2 must be string or None, not Delay

>>> m.serialize()
'<message to="w at t"><x xmlns="jabber:x:delay" stamp="20070221T03:20:03"
from="w at t">None</x></message>'



P.S. Anybody going to FOSDEM in Bruxels next weekend?

jid:winfried at jabber.xs4all.nl
tel. 015-3613996 / 06-23303960
fax. 015-3614406

More information about the PyXMPP mailing list