[JDEV] Problem with PyJabber

Zoe Drey Zoe.Drey at logilab.fr
Wed Dec 5 10:03:35 CST 2001


Hi,
Does someone work with PyJabber here?
In this case, you can read the following :(sorry, my english
is not very good...)

I'm using PyJabber and have a problem with printing
the xml string associated with a JabberPacket:
I'm using the output() method for that, but for the following packet:
<iq xmlns='jabber:client' type='result' id='pthsock_client_auth_ID'/>,
output() doesn't seem to "work":

when i put in my code:

==========================
p.element_tree().output(), where p is a JabberPackets.IQ instance,
==========================
i get the following error:

======================================================================
[...]
  File "/home/zoe/logilab/nlp/PyJabber/Element.py", line 156, in output
    textlist.append(e.output(depth, name[0]))
AttributeError: 'None' object has no attribute 'output'
=================^^^^^^^^^^^==========================================

p.element_tree() gives me:
{'id': 'pthsock_client_auth_ID','type': 'result'}

so to correct the error, there's a tiny modification to make in output()
method, ---but i'm not sure if i'm right or not by doing that---
to stop recursive calls when needed.

===========================================================
        for e in self.children: #Loop through nested elements
            if depth >= 0:
                textlist.append(e.output(depth + 1, name[0]))
            elif e is not None:
                textlist.append(e.output(depth, name[0]))
===============================================================

instead of:

===========================================================
        for e in self.children: #Loop through nested elements
            if depth >= 0:
                textlist.append(e.output(depth + 1, name[0]))
            else:
                textlist.append(e.output(depth, name[0]))
=============================================================== 


-- 
Zoé Drey




More information about the JDev mailing list